erofs: fix compact 4B support for 16k block size
[platform/kernel/linux-starfive.git] / fs / erofs / zmap.c
index 3961bb5..0337b70 100644 (file)
@@ -271,7 +271,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;
@@ -373,7 +373,6 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m,
 {
        struct inode *const inode = m->inode;
        struct erofs_inode *const vi = EROFS_I(inode);
-       const unsigned int lclusterbits = vi->z_logical_clusterbits;
        const erofs_off_t ebase = sizeof(struct z_erofs_map_header) +
                ALIGN(erofs_iloc(inode) + vi->inode_isize + vi->xattr_isize, 8);
        const unsigned int totalidx = DIV_ROUND_UP(inode->i_size, EROFS_BLKSIZ);
@@ -381,9 +380,6 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m,
        unsigned int amortizedshift;
        erofs_off_t pos;
 
-       if (lclusterbits != 12)
-               return -EOPNOTSUPP;
-
        if (lcn >= totalidx)
                return -EINVAL;