[PATCH] erofs-utils: generate preallocated extents for tarerofs

Gao Xiang hsiangkao at linux.alibaba.com
Tue Aug 1 13:04:56 AEST 2023



On 2023/8/1 10:52, Jingbo Xu wrote:
> 
> 
> On 7/29/23 9:32 PM, Gao Xiang wrote:
>>   
>> -int erofs_blob_remap(struct erofs_sb_info *sbi)
>> +int tarerofs_write_chunk_data(struct erofs_inode *inode, erofs_off_t data_offset)
>> +{
>> +	struct erofs_sb_info *sbi = inode->sbi;
>> +	unsigned int chunkbits = ilog2(inode->i_size - 1) + 1;
> 
> What if inode->i_size is 0 ?

if (chunkbits - sbi->blkszbits > EROFS_CHUNK_FORMAT_BLKBITS_MASK)
	chunkbits = EROFS_CHUNK_FORMAT_BLKBITS_MASK + sbi->blkszbits;

will just generate a large chunk for this.

Actually I think we shouldn't use chunk-based format if inode->i_size
is 0, it needs to be fixed in a seperate commit.

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list