]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
erofs: add sparse support to pcluster layout
authorGao Xiang <hsiangkao@linux.alibaba.com>
Sun, 21 Jun 2026 19:44:14 +0000 (03:44 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Sun, 21 Jun 2026 22:48:59 +0000 (06:48 +0800)
commite87827da8c351db0de504534e6aa17be3014bc25
treeaaf2caba31c00e8f5663d837d0ccb48d57537107
parent28c5d230980bdd8cb18c073225296c7747995935
erofs: add sparse support to pcluster layout

Although zeros can be compressed transparently on EROFS using fixed-size
output compression so that it is never prioritized in the Android use
cases, indicating entire pclusters as holes is still useful to preserve
holes in the sparse datasets; otherwise overlayfs will allocate more
space when copying up, and SEEK_HOLE won't report any hole.

This patch introduces two ways to mark a pcluster as a hole:

 - A new Z_EROFS_LI_HOLE compatible flag (bit 14) in the HEAD lcluster
   advise field for non-compact (full) indexes;

 - A 0-block CBLKCNT value on the first NONHEAD lcluster.

The hole tag is preferred for maximum compatibility since pre-existing
kernels that do not understand Z_EROFS_LI_HOLE will decompress at the
stored blkaddr (the same blkaddr will be shared among all sparse
pclusters).  Only the 0-block CBLKCNT approach also works for compact
indexes, but it is limited to big pclusters and new kernels.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
fs/erofs/erofs_fs.h
fs/erofs/zmap.c