• Huang Jianan's avatar
    erofs: support adjust lz4 history window size · 5d50538f
    Huang Jianan authored
    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.comReviewed-by: default avatarChao Yu <yuchao0@huawei.com>
    Signed-off-by: default avatarHuang Jianan <huangjianan@oppo.com>
    Signed-off-by: default avatarGuo Weichao <guoweichao@oppo.com>
    [ Gao Xiang: introduce struct erofs_sb_lz4_info for configurations. ]
    Signed-off-by: default avatarGao Xiang <hsiangkao@redhat.com>
    5d50538f
internal.h 12.8 KB