Skip to contentSkip to conversation

erofs-utils: fsck: fix support for 16k block size

PATCH Applied Sandeep Dhavale via Linux-erofs 2 participants 2 messages Sep 12, 2023 – Sep 13, 2023 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 erofs-utils: fsck: fix support for 16k block size

This basically follows the fix in kernel commit 001b8ccd0650 (erofs: fix compact 4B support for 16k block size).

Without this patch fsck on images with 16k block size reports corruption which is not correct.

Fixes 76b822726ff8 ("erofs-utils: introduce compacted compression

indexes")

---
 lib/zmap.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
lib/zmap.c +1 -5
index cd91ca5..81fa22b 100644
@@ -244,7 +244,7 @@ static int unpack_compacted_index(struct z_erofs_maprecorder *m,
 	u8 *in, type;
 	bool big_pcluster;
 
-	if (1 << amortizedshift == 4)
+	if (1 << amortizedshift == 4 && lclusterbits <= 14)
 		vcnt = 2;
 	else if (1 << amortizedshift == 2 && lclusterbits == 12)
 		vcnt = 16;
@@ -346,7 +346,6 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m,
 {
 	struct erofs_inode *const vi = m->inode;
 	struct erofs_sb_info *sbi = vi->sbi;
-	const unsigned int lclusterbits = vi->z_logical_clusterbits;
 	const erofs_off_t ebase = round_up(erofs_iloc(vi) + vi->inode_isize +
 					   vi->xattr_isize, 8) +
 		sizeof(struct z_erofs_map_header);
@@ -356,9 +355,6 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m,
 	erofs_off_t pos;
 	int err;
 
-	if (lclusterbits != 12)
-		return -EOPNOTSUPP;
-
 	if (lcn >= totalidx)
 		return -EINVAL;
 
Signature · 1 line
2.42.0.283.g2d96d420d3-goog
Applied
#1 lore raw
Quoted 11 lines · Sandeep Dhavale

This basically follows the fix in kernel commit 001b8ccd0650 (erofs: fix compact 4B support for 16k block size).

Without this patch fsck on images with 16k block size reports corruption which is not correct.

Fixes 76b822726ff8 ("erofs-utils: introduce compacted compression

indexes")

Thanks! applied with slight commit message style
adjustment.

Thanks,
Gao Xiang