Whamcloud - gitweb
EX-6127 llite: getting stripe info optimization
authorArtem Blagodarenko <ablagodarenko@ddn.com>
Wed, 14 Jun 2023 21:10:28 +0000 (22:10 +0100)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 23 Jun 2023 23:37:21 +0000 (23:37 +0000)
ll_lov_getstripe_ea_info() is expensive call and should be avoided
if possible. Let's use cached chunk size rather than get it from
stripe info every time.

Signed-off-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Change-Id: Id08487ec782f797e242e3f673c4a4dd8d526c9cc
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51321
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/llite/rw.c
lustre/tests/sanity.sh

index 97167cb..cbf9167 100644 (file)
@@ -731,6 +731,8 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io,
        __u64 kms;
        struct ll_sb_info *sbi;
        struct ll_ra_info *ra;
+       unsigned int chunk_bits = 0;
+
         ENTRY;
 
        BUILD_BUG_ON(PAGE_SHIFT > 16);
@@ -759,6 +761,9 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io,
                RETURN(0);
        }
 
+       if (io->ci_compressed_io)
+               chunk_bits = io->ci_compr_chunk_bits;
+
        spin_lock(&ras->ras_lock);
 
        /**
@@ -774,6 +779,12 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io,
        else
                *start_idx = ras->ras_next_readahead_idx;
 
+       if (chunk_bits) {
+               CDEBUG(D_SEC, "start_idx %lu\n", *start_idx);
+               *start_idx &= ~((COMPR_MIN_PAGES << chunk_bits) - 1);
+               CDEBUG(D_SEC, "start_idx %lu\n", *start_idx);
+       }
+
        if (ras->ras_window_pages > 0)
                end_idx = ras->ras_window_start_idx + ras->ras_window_pages - 1;
 
@@ -815,6 +826,18 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io,
                RETURN(0);
        }
 
+       if (chunk_bits) {
+               int chunk_pages = COMPR_MIN_PAGES << chunk_bits;
+               CDEBUG(D_SEC, "end_idx %lu\n", end_idx);
+               if ( end_idx & (chunk_pages - 1)) {
+                       end_idx &= ~(chunk_pages - 1);
+                       end_idx += chunk_pages;
+                       vio->vui_ra_pages &= ~(chunk_pages - 1);
+                       vio->vui_ra_pages += chunk_pages;
+               }
+               CDEBUG(D_SEC, "end_idx %lu\n", end_idx);
+       }
+
        RAS_CDEBUG(ras);
        CDEBUG(D_READA, DFID": ria: %lu/%lu, bead: %lu/%lu, hit: %d\n",
               PFID(lu_object_fid(&clob->co_lu)),
index 43b178c..89e45cb 100755 (executable)
@@ -27524,6 +27524,7 @@ compress_type() {
        local decomp1=$TMP/$tdir/$tfile.dec_$orig_short.$t1$l1$c1
        local decomp2=$TMP/$tdir/$tfile.dec_$orig_short.$t1$l1$c1.cp
        local decomp3=$TMP/$tdir/$tfile.dec_$orig_short.$t1$l1$c1.32.1.5
+       local decomp4=$TMP/$tdir/$tfile.dec_$orig_short.$t1$l1$c1.32.1.5.orig
 
        $LFS setstripe -E 512K -Z $t1:$l1 -E 768K -Z none -E -1 -Z $t1:$l1 \
                --compress-chunk=$c1 $stored_dir ||
@@ -27567,6 +27568,18 @@ compress_type() {
        diff $orig $decomp2 ||
                error "decompression failed"
 
+       # Reading starting the 480K offset
+       # on compressed/plain data board
+       dd if=$stored of=$decomp3 \
+               bs=32k count=2 skip=15 &>/dev/null ||
+               error "dd to $decomp3 failed"
+
+       dd if=$orig of=$decomp4 \
+               bs=32k count=2 skip=15 &>/dev/null ||
+               error "dd to $decomp4 failed"
+
+       cmp --verbose $decomp3 $decomp4 || error "decompression failed"
+
        # Copy file with direct I/O (falls back to buffered I/O)
        dd if=$orig of=$stored3 bs=$PAGE_SIZE oflag=direct ||
                error "dd to $stored3 failed"