linux-stable/fs/erofs
Gao Xiang 24331050a3 erofs: fix small compressed files inlining
Prior to ztailpacking feature, it's enough that each lcluster has
two pclusters at most, and the last pcluster should be turned into
an uncompressed pcluster when necessary. For example,
  _________________________________________________
 |_ pcluster n-2 _|_ pcluster n-1 _|____ EOFed ____|

which should be converted into:
  _________________________________________________
 |_ pcluster n-2 _|_ pcluster n-1 (uncompressed)' _|

That is fine since either pcluster n-1 or (uncompressed)' takes one
physical block.

However, after ztailpacking was supported, the game is changed since
the last pcluster can be inlined now. And such case above is quite
common for inlining small files. Therefore, in order to inline more
effectively, special EOF lclusters are now supported which can have
three parts at most, as illustrated below:
  _________________________________________________
 |_ pcluster n-2 _|_ pcluster n-1 _|____ EOFed ____|
                                   ^ i_size

Actually similar code exists in Yue Hu's original patchset [1], but I
removed this part on purpose. After evaluating more real cases with
small files, I've changed my mind.

[1] https://lore.kernel.org/r/20211215094449.15162-1-huyue2@yulong.com

Link: https://lore.kernel.org/r/20220203190203.30794-1-xiang@kernel.org
Fixes: ab92184ff8 ("erofs: add on-disk compressed tail-packing inline support")
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2022-02-04 12:37:12 +08:00
..
compress.h erofs: introduce z_erofs_fixup_insize 2021-12-29 06:42:07 +08:00
data.c erofs: fix fsdax partition offset handling 2022-01-24 22:36:27 +08:00
decompressor.c erofs: support unaligned data decompression 2021-12-31 00:48:43 +08:00
decompressor_lzma.c erofs: introduce z_erofs_fixup_insize 2021-12-29 06:42:07 +08:00
dir.c erofs: clean up file headers & footers 2021-06-08 00:41:24 +08:00
erofs_fs.h erofs: add on-disk compressed tail-packing inline support 2021-12-31 00:51:10 +08:00
inode.c erofs: use meta buffers for inode operations 2022-01-04 23:44:46 +08:00
internal.h dax + libnvdimm for v5.17 2022-01-12 15:46:11 -08:00
Kconfig erofs: lzma compression support 2021-10-19 23:44:30 +08:00
Makefile erofs: add sysfs interface 2021-12-08 09:40:37 +08:00
namei.c erofs: add fiemap support with iomap 2021-08-19 00:13:43 +08:00
pcpubuf.c erofs: get rid of ->lru usage 2021-10-25 08:22:59 +08:00
super.c dax + libnvdimm for v5.17 2022-01-12 15:46:11 -08:00
sysfs.c erofs: add on-disk compressed tail-packing inline support 2021-12-31 00:51:10 +08:00
tagptr.h erofs: clean up file headers & footers 2021-06-08 00:41:24 +08:00
utils.c erofs: fix deadlock when shrink erofs slab 2021-11-23 14:58:16 +08:00
xattr.c erofs: use meta buffers for xattr operations 2022-01-04 23:47:08 +08:00
xattr.h erofs: use meta buffers for xattr operations 2022-01-04 23:47:08 +08:00
zdata.c erofs: avoid unnecessary z_erofs_decompressqueue_work() declaration 2022-01-24 22:36:53 +08:00
zdata.h erofs: support inline data decompression 2021-12-31 00:50:50 +08:00
zmap.c erofs: fix small compressed files inlining 2022-02-04 12:37:12 +08:00
zpvec.h erofs: fix unsafe pagevec reuse of hooked pclusters 2021-11-08 10:02:10 +08:00