diff options
| author | Qu Wenruo <[email protected]> | 2024-09-06 04:10:30 +0000 |
|---|---|---|
| committer | David Sterba <[email protected]> | 2024-11-11 13:34:12 +0000 |
| commit | 90275a7762c85bde21c0884404993ed20e265d86 (patch) | |
| tree | e721ba72d396f4b2282d2a667e9c370bd8996551 /fs/btrfs/compression.c | |
| parent | btrfs: zlib: make the compression path to handle sector size < page size (diff) | |
| download | kernel-90275a7762c85bde21c0884404993ed20e265d86.tar.gz kernel-90275a7762c85bde21c0884404993ed20e265d86.zip | |
btrfs: zstd: make the compression path to handle sector size < page size
Inside zstd_compress_folios(), after exhausted one input page, we need
to switch to the next page as input.
However when counting the total input bytes (@tot_in), we always increase
it by PAGE_SIZE.
For the following case, it can cause incorrect value:
0 32K 64K 96K
| |///////////||///////////|
After compressing range [32K, 64K), we switch to the next page, and
increasing @tot_in by 64K, while we only read 32K.
This will cause the @total_in to return a value larger than the input
length.
Fix it by only increase @tot_in by the input size.
Signed-off-by: Qu Wenruo <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/btrfs/compression.c')
0 files changed, 0 insertions, 0 deletions
