erofs-utils: lib: fix incorrect nblocks in block list for chunked inodes
PATCH v3 1/1 erofs-utils: lib: fix incorrect nblocks in block list for chunked inodes
Currently, the number of physical blocks (nblocks) for the last chunk written to the block list file is incorrectly recorded as the inode chunksize.
This patch writes the actual number of physical blocks for the inode in the last chunk to the block list file.
---
v3: Make the computed extend_end have impact on erofs_droid_blocklist_write_extent().
v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/
--- lib/blobchunk.c | 3 +++ 1 file changed, 3 insertions(+)
lib/blobchunk.c +3 -0
@@ -133,6 +133,7 @@ static int erofs_blob_hashmap_cmp(const void *a, const void *b,int erofs_blob_write_chunk_indexes (struct erofs_inode *inode,erofs_off_t off) { +erofs_blk_t remaining_blks =BLK_ROUND_UP (inode->sbi, inode->i_size);struct erofs_inode_chunk_index idx = {0 };erofs_blk_t extent_start =EROFS_NULL_ADDR ;erofs_blk_t extent_end, chunkblks;
@@ -165,6 +166,7 @@ int erofs_blob_write_chunk_indexes(struct erofs_inode *inode,if (extent_start ==EROFS_NULL_ADDR || idx.blkaddr != extent_end) {if (extent_start !=EROFS_NULL_ADDR ) { + remaining_blks -= extent_end - extent_start;tarerofs_blocklist_write (extent_start, extent_end - extent_start, source_offset);
@@ -187,6 +189,7 @@ int erofs_blob_write_chunk_indexes(struct erofs_inode *inode,memcpy (inode->chunkindexes + dst, &idx,sizeof (idx)); } off =roundup (off, unit); + extent_end =min (extent_end, extent_start + remaining_blks);if (extent_start !=EROFS_NULL_ADDR )tarerofs_blocklist_write (extent_start, extent_end - extent_start, source_offset);
Signature · 1 line
2.43.5
Quoted 6 lines · Hongzhen Luo
Currently, the number of physical blocks (nblocks) for the last chunk written to the block list file is incorrectly recorded as the inode chunksize.
This patch writes the actual number of physical blocks for the inode in the last chunk to the block list file.
You should attach "Fixes:" tags here as I previously suggested. I will manually add for this time.
Quoted 2 lines
Signed-off-by Hongzhen Luo <[email protected]>
Otherwise it looks good to me.
Thanks,
Gao Xiang
Quoted 7 lines · Gao Xiang
Quoted 4 lines · Hongzhen Luo
Currently, the number of physical blocks (nblocks) for the last chunk written to the block list file is incorrectly recorded as the inode chunksize.
Quoted 6 lines
Quoted 2 lines
This patch writes the actual number of physical blocks for the inode in the last chunk to the block list file.
You should attach "Fixes:" tags here as I previously suggested. I will manually add for this time.
Sure, I will do it this way in the future.
Thanks,
Hongzhen Luo
Quoted 7 lines
Quoted 2 lines
Signed-off-by Hongzhen Luo <[email protected]>Otherwise it looks good to me.
Thanks,
Gao Xiang