Whamcloud - gitweb
EX-7601 ofd: clear pages in decompression
Handling writes to compressed files requires a
read-modify-write cycle, which has implications for how we
handle reads.
Consider the case of a file with an 8 KiB write at offset 0,
which is compressed to 4 KiB. Then there is another 4 KiB
write at offset 16 KiB.
Updating this correctly requires reading the first chunk,
then decompressing it. However, this read will go past
EOF, because the write has not occurred yet. The OSD read
code does not fill in these pages, because read past EOF is
not returned to the client (client gets a short read and
does not actually use the pages).
In our case, however, we must use these pages (from 8 KiB
16 KiB). In the naive version without recompression, we
simply write out 0 - 16 KiB, so we must have zeroes in
those pages, and once we have recompression, we must
compress those pages so we need zeroes in that case too.
So we note if a page has data in it after decompression,
then if it does not, we clear the page. Note we do NOT set
lnb_rc to 0 when we clear a page, because lnb_rc = 0 is
used to indicate EOF rather than a gap in the file.
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: If1d1360185eb087e821167a08e49c9427e29ffc4
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53302
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>