Whamcloud - gitweb
EX-7601 osc: allow multiple chunks in read
authorPatrick Farrell <pfarrell@whamcloud.com>
Thu, 16 Nov 2023 23:26:26 +0000 (18:26 -0500)
committerAndreas Dilger <adilger@whamcloud.com>
Mon, 27 Nov 2023 18:38:03 +0000 (18:38 +0000)
It's rare, but reads can sometimes have multiple
discontiguous chunks.  Update decompress_request to
handle this case.

Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I880af95db285dce76db3610e8140a0f54baa401b
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53159
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/osc/osc_compress.c

index ebe1487..6a921df 100644 (file)
@@ -245,11 +245,11 @@ int decompress_request(struct osc_brw_async_args *aa, int page_count)
        unsigned int src_size;
        unsigned int dst_size;
        int pages_per_chunk;
-       int pages_left;
        char *src = NULL;
        char *dst = NULL;
        int chunk_bits;
        int chunk_size;
+       int pages_left;
        int count = 0;
        int buf_bits;
        int rc = 0;
@@ -271,29 +271,18 @@ int decompress_request(struct osc_brw_async_args *aa, int page_count)
        rc = alloc_compr(obd_name, &type, lvl, &cc, true);
        if (rc)
                GOTO(out, rc);
-       /* the RPC may not start on a chunk boundary, find the first chunk
-        * boundary, then start iterating by chunk_size at that point (in the
-        * next loop)
-        */
+
        for (i = 0; i < page_count; i++) {
                oap = brw_page2oap(pga[i]);
+               CDEBUG(D_SEC, "checking page %d, offset %llu\n",
+                      i, oap->oap_obj_off);
 
-               /* aligned to chunk size */
-               if (!(oap->oap_obj_off & (chunk_size - 1)))
-                       break;
-       }
-
-       /* no chunk aligned pages in the RPC, no possibility of a compressed
-        * chunk
-        */
-       if (i == page_count)
-               GOTO(out, rc = 0);
-
-       CDEBUG(D_SEC, "starting decompression at page %d, offset %llu\n",
-              i, oap->oap_obj_off);
+               /* not aligned to chunk size, so can't be the start of a
+                * compressed chunk - continue
+                */
+               if (oap->oap_obj_off & (chunk_size - 1))
+                       continue;
 
-       /* i is the first chunk aligned page in the RPC */
-       for (; i < page_count; i+=pages_per_chunk) {
                if (!is_chunk_start(pga[i]->pg, &llch))
                        continue;