diff options
author | Huang Jianan <huangjianan@oppo.com> | 2021-03-29 09:23:06 +0800 |
---|---|---|
committer | Gao Xiang <hsiangkao@redhat.com> | 2021-03-29 10:24:58 +0800 |
commit | 5d50538fc567c6f3692dec1825fb38c5a0884d93 (patch) | |
tree | 93389d04bec73677d08776d3306b8288949d192e /fs/erofs/super.c | |
parent | de06a6a375414be03ce5b1054f2d836591923a1d (diff) | |
download | linux-stable-5d50538fc567c6f3692dec1825fb38c5a0884d93.tar.gz linux-stable-5d50538fc567c6f3692dec1825fb38c5a0884d93.tar.bz2 linux-stable-5d50538fc567c6f3692dec1825fb38c5a0884d93.zip |
erofs: support adjust lz4 history window size
lz4 uses LZ4_DISTANCE_MAX to record history preservation. When
using rolling decompression, a block with a higher compression
ratio will cause a larger memory allocation (up to 64k). It may
cause a large resource burden in extreme cases on devices with
small memory and a large number of concurrent IOs. So appropriately
reducing this value can improve performance.
Decreasing this value will reduce the compression ratio (except
when input_size <LZ4_DISTANCE_MAX). But considering that erofs
currently only supports 4k output, reducing this value will not
significantly reduce the compression benefits.
The maximum value of LZ4_DISTANCE_MAX defined by lz4 is 64k, and
we can only reduce this value. For the old kernel, it just can't
reduce the memory allocation during rolling decompression without
affecting the decompression result.
Link: https://lore.kernel.org/r/20210329012308.28743-3-hsiangkao@aol.com
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
Signed-off-by: Guo Weichao <guoweichao@oppo.com>
[ Gao Xiang: introduce struct erofs_sb_lz4_info for configurations. ]
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
Diffstat (limited to 'fs/erofs/super.c')
-rw-r--r-- | fs/erofs/super.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 991b99eaf22a..3212e4f73f85 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -187,7 +187,9 @@ static int erofs_read_superblock(struct super_block *sb) ret = -EFSCORRUPTED; goto out; } - ret = 0; + + /* parse on-disk compression configurations */ + ret = z_erofs_load_lz4_config(sb, dsb); out: kunmap(page); put_page(page); |