• Chao Yu's avatar
    f2fs: compress: let lz4 compressor handle output buffer budget properly · f6644143
    Chao Yu authored
    Commonly, in order to handle lz4 worst compress case, caller should
    allocate buffer with size of LZ4_compressBound(inputsize) for target
    compressed data storing, however in this case, if caller didn't
    allocate enough space, lz4 compressor still can handle output buffer
    budget properly, and end up compressing when left space in output
    buffer is not enough.
    
    So we don't have to allocate buffer with size for worst case, then
    we can avoid 2 * 4KB size intermediate buffer allocation when
    log_cluster_size is 2, and avoid unnecessary compressing work of
    compressor if we can not save at least 4KB space.
    Suggested-by: default avatarDaeho Jeong <daehojeong@google.com>
    Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
    Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    f6644143
compress.c 33.7 KB