]> asedeno.scripts.mit.edu Git - linux.git/commit
staging: erofs: introduce LZ4 decompression inplace
authorGao Xiang <gaoxiang25@huawei.com>
Mon, 24 Jun 2019 07:22:56 +0000 (15:22 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Jun 2019 01:44:40 +0000 (09:44 +0800)
commit0ffd71bcc3a03ebb3551661a36052488369c4de9
tree8c75db866178919fcac405c5415ff4b505af793a
parent7fc45dbc938a2e69ecd6a78a3c0074aa6c11fac9
staging: erofs: introduce LZ4 decompression inplace

compressed data will be usually loaded into last pages of
the extent (the last page for 4k) for in-place decompression
(more specifically, in-place IO), as ilustration below,

         start of compressed logical extent
           |                          end of this logical extent
           |                           |
     ______v___________________________v________
... |  page 6  |  page 7  |  page 8  |  page 9  | ...
    |__________|__________|__________|__________|
           .                         ^ .        ^
           .                         |compressed|
           .                         |   data   |
           .                           .        .
           |<          dstsize        >|<margin>|
                                       oend     iend
           op                        ip

Therefore, it's possible to do decompression inplace (thus no
memcpy at all) if the margin is sufficient and safe enough [1],
and it can be implemented only for fixed-size output compression
compared with fixed-size input compression.

No memcpy for most of in-place IO (about 99% of enwik9) after
decompression inplace is implemented and sequential read will
be improved of course (see the following patches for test results).

[1] https://github.com/lz4/lz4/commit/b17f578a919b7e6b078cede2d52be29dd48c8e8c
    https://github.com/lz4/lz4/commit/5997e139f53169fa3a1c1b4418d2452a90b01602

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/erofs/compress.h
drivers/staging/erofs/decompressor.c
drivers/staging/erofs/erofs_fs.h