From: Artem Blagodarenko Date: Thu, 21 Mar 2024 17:39:03 +0000 (+0000) Subject: EX-9196 csdc: do not round lnb size up to the PAGE_SIZE X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=aec1a05dcb69bc0a9c29c3df0ac5d661487f882d;p=fs%2Flustre-release.git EX-9196 csdc: do not round lnb size up to the PAGE_SIZE lnb size is successfully updated to the right one in case the chunk has been decompressed but left equual to the PAGE_SIZE in case it hasn't. This leads to the wrong file size change. This patch set lnb size before the decompression, so if lnb hasn't decompressed this size is left as is. Signed-off-by: Artem Blagodarenko Test-Parameters: trivial testlist=sanity-compr env=ONLY=1003 Change-Id: I4b8149cc3aab1973a1a261b2e164c321019a437e Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54518 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger --- diff --git a/lustre/ofd/ofd_compress.c b/lustre/ofd/ofd_compress.c index 260207d..edea35a 100644 --- a/lustre/ofd/ofd_compress.c +++ b/lustre/ofd/ofd_compress.c @@ -147,6 +147,12 @@ out: * to write them out */ for(i = lnb_start; i < lnb_start + pages_in_chunk; i++) { + if (write && lnbs[i].lnb_rc > 0) { + CDEBUG(D_SEC, "set lnb %i len to %u\n", + i, lnbs[i].lnb_rc); + lnbs[i].lnb_len = lnbs[i].lnb_rc; + } + /* if there's no data in this page, we must clear it */ if (!write && lnbs[i].lnb_rc == 0) { CDEBUG(D_SEC, "%s: no data, clearing: page %d, "DFID" at %llu\n", diff --git a/lustre/ofd/ofd_io.c b/lustre/ofd/ofd_io.c index 42c3fae..239d466 100644 --- a/lustre/ofd/ofd_io.c +++ b/lustre/ofd/ofd_io.c @@ -1136,6 +1136,17 @@ static int ofd_preprw_write(const struct lu_env *env, struct obd_export *exp, nr_read, true); if (unlikely(rc != 0)) GOTO(err, rc); + + /* + * If any lnb will not be decompressed it needs to have + * original data size in the lnb. Save it here. + */ + for (i = 0; i < nr_read; i++) { + unsigned int size_delta = la->la_size - read_lnb[i].lnb_file_offset; + if (read_lnb[i].lnb_rc > 0 && size_delta < PAGE_SIZE) + read_lnb[i].lnb_rc = size_delta; + } + rc = ofd_decompress_read(env, exp, oa, rnb, read_lnb, obj, nr_read, eof_rnb, type, lvl, chunk_bits, true); diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 2e709c8..a41961f 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -10740,6 +10740,10 @@ disable_compression() { } flush_and_compare() { + cancel_lru_locks osc + cancel_lru_locks mdc + sleep 1 + ls -la $1 $2 # Compare using data in cache cmp -bl $1 $2 || error "$3 failed compare in cache"