Commit cc6111a2 authored by sunshijie's avatar sunshijie Committed by Sandeep Dhavale
Browse files

UPSTREAM: erofs: fix compact 4B support for 16k block size



In compact 4B, two adjacent lclusters are packed together as a unit to
form on-disk indexes for effective random access, as below:

(amortized = 4, vcnt = 2)
       _____________________________________________
      |___@_____ encoded bits __________|_ blkaddr _|
      0        .                                    amortized * vcnt = 8
      .             .
      .                  .              amortized * vcnt - 4 = 4
      .                        .
      .____________________________.
      |_type (2 bits)_|_clusterofs_|

Therefore, encoded bits for each pack are 32 bits (4 bytes). IOWs,
since each lcluster can get 16 bits for its type and clusterofs, the
maximum supported lclustersize for compact 4B format is 16k (14 bits).

Fix this to enable compact 4B format for 16k lclusters (blocks), which
is tested on an arm64 server with 16k page size.

Fixes: 152a333a ("staging: erofs: add compacted compression indexes support")
Signed-off-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230601112341.56960-1-hsiangkao@linux.alibaba.com


Signed-off-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
(cherry picked from commit 001b8ccd
    https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git

 dev)
Bug: 296824280

Change-Id: I97918294a1d00a65223e741c3d153f375ab50507
Signed-off-by: default avatarsunshijie <sunshijie@xiaomi.corp-partner.google.com>
Signed-off-by: default avatarsunshijie <sunshijie@xiaomi.com>
parent f11ccb03
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment