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

Reply via email to