erofs-utils: support decompress in-place
In the view of kernel, it usually loads compressed data 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
It's natural to think it further, why not decompressing in-place?
1) Decompressing in-place can be easily implemented since oend is
_strictly_ not greater than iend for fixed-output decompression;
2) Decompressing in-place can be guaranteed with a appropriate
minimum margin rather than do decompress simulatation
for all extents;
*) Many implementations of memcpy can perform overlapped copy
well if op <= ip (it'd better to use memmove, of course).
This patch enables 0PADDING in order to support decompress in-place.
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
5 files changed