erofs: fix up compacted indexes for block size < 4096
authorGao Xiang <hsiangkao@linux.alibaba.com>
Wed, 6 Dec 2023 09:10:55 +0000 (17:10 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 14 Dec 2023 17:47:19 +0000 (01:47 +0800)
commit8d2517aaeea3ab8651bb517bca8f3c8664d318ea
tree9da0507b31d028d11a506276230dc55d773c0142
parent54ed3fdd66055d073cb1cd2c6c65bbc0683c40cf
erofs: fix up compacted indexes for block size < 4096

Previously, the block size always equaled to PAGE_SIZE, therefore
`lclusterbits` couldn't be less than 12.

Since sub-page compressed blocks are now considered, `lobits` for
a lcluster in each pack cannot always be `lclusterbits` as before.
Otherwise, there is no enough room for the special value
`Z_EROFS_LI_D0_CBLKCNT`.

To support smaller block sizes, `lobits` for each compacted lcluster is
now calculated as:
   lobits = max(lclusterbits, ilog2(Z_EROFS_LI_D0_CBLKCNT) + 1)

Reviewed-by: Yue Hu <huyue2@coolpad.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20231206091057.87027-4-hsiangkao@linux.alibaba.com
fs/erofs/zmap.c