aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandeep Dhavale <dhavale@google.com>2023-09-12 15:12:04 -0700
committerGao Xiang <hsiangkao@linux.alibaba.com>2023-09-13 10:15:52 +0800
commit255011240819a14c289c18615d86c92481f9674d (patch)
treeeda7cf58ee0b8dcdd067f197f480d7d625f7988d
parent6d018b65da3935f0148a1325b8dccd6e4bfbe993 (diff)
downloaderofs-utils-255011240819a14c289c18615d86c92481f9674d.tar.gz
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") Signed-off-by: Sandeep Dhavale <dhavale@google.com> Link: https://lore.kernel.org/r/20230912221204.52184-1-dhavale@google.com Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
-rw-r--r--lib/zmap.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/zmap.c b/lib/zmap.c
index cd91ca5..81fa22b 100644
--- a/lib/zmap.c
+++ b/lib/zmap.c
@@ -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;