Whamcloud - gitweb
EX-9196 csdc: do not round lnb size up to the PAGE_SIZE
authorArtem Blagodarenko <ablagodarenko@ddn.com>
Thu, 21 Mar 2024 17:39:03 +0000 (17:39 +0000)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 23 Mar 2024 20:33:14 +0000 (20:33 +0000)
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 <ablagodarenko@ddn.com>
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 <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/ofd/ofd_compress.c
lustre/ofd/ofd_io.c
lustre/tests/test-framework.sh

index 260207d..edea35a 100644 (file)
@@ -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",
index 42c3fae..239d466 100644 (file)
@@ -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);
index 2e709c8..a41961f 100755 (executable)
@@ -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"