Whamcloud - gitweb
LU-17468 lod: component add missed pattern info
authorBobi Jam <bobijam@whamcloud.com>
Wed, 24 Jan 2024 17:08:33 +0000 (01:08 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Mon, 29 Jan 2024 08:56:56 +0000 (08:56 +0000)
"lfs setstripe --commponent-add" missed setting component pattern,
which causes some setting missing, like overstriping, compression.

Lustre-change: https://review.whamcloud.com/53817
Lustre-commit: TBD (from 3849e3efdc58d535ee6858aafa22cfdc665ba2d7)

Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: I7ad746a550f1afea54a6f5b68823a79a85a44082
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53811
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/lod/lod_object.c
lustre/tests/sanity-compr.sh
lustre/tests/sanity.sh

index 0867783..94aefca 100644 (file)
@@ -2853,6 +2853,7 @@ static int lod_declare_layout_add(const struct lu_env *env,
 
                lod_comp->llc_stripe_size = v1->lmm_stripe_size;
                lod_comp->llc_stripe_count = v1->lmm_stripe_count;
+               lod_comp->llc_pattern = v1->lmm_pattern;
                /**
                 * limit stripe count so that it's less than/equal to
                 * extent_size / stripe_size.
@@ -2878,7 +2879,6 @@ static int lod_declare_layout_add(const struct lu_env *env,
 
                lod_comp->llc_compr_type =
                                comp_v1->lcm_entries[i].lcme_compr_type;
-
                lod_comp->llc_compr_lvl =
                                comp_v1->lcm_entries[i].lcme_compr_lvl;
                lod_comp->llc_compr_chunk_log_bits =
index 7055637..6e38b70 100644 (file)
@@ -121,6 +121,22 @@ test_0b() {
 }
 run_test 0b "compression types negotiation between client and MDT"
 
+test_1a() {
+       local tf=$DIR/$tfile
+       stack_trap "rm -f $tf; disable_compression"
+       enable_compression
+
+       $LFS setstripe -E1M $tf || error "setstripe failed"
+       $LFS setstripe -Eeof --component-add -Z gzip $tf ||
+               error "add compression component failed"
+
+       $LFS getstripe -I2 --compr-type $tf | grep "gzip" || {
+               $LFS getstripe -v $tf
+               error "added component should be a compression one"
+       }
+}
+run_test 1a "add a compression component"
+
 test_sanity()
 {
        always_except LU-16928 56wb
index 5dfbaa2..9cb3a42 100755 (executable)
@@ -2623,6 +2623,36 @@ test_27Ch() {
 }
 run_test 27Ch "overstriping with -C -1 in mdt_dump_lmm"
 
+test_27Ci() {
+       local tf=$DIR/$tfile
+
+       stack_trap "rm -f $DIR/$tfile"
+
+       $LFS setstripe -E1M $tf || error "create $tf failed"
+       $LFS setstripe -Eeof --component-add -C 100 $tf ||
+               error "add component failed"
+
+       $LFS getstripe -I2 $tf | awk '/lmm_pattern/ { print $2 }' |
+               grep "overstriped" || {
+               $LFS getstripe $tf
+               echo "lose overstriping setting"
+       }
+       sc=$($LFS getstripe -I2 --stripe-count $tf)
+       (( $sc == 100 )) || {
+               $LFS getstripe $tf
+               echo "lose overstriping setting"
+       }
+
+       stack_trap "rm -f $tf"
+       dd if=/dev/zero of=$tf bs=1M count=10 || error "write $tf"
+       sc=$($LFS getstripe -I2 --stripe-count $tf)
+       (( $sc == 100 )) || {
+               $LFS getstripe $tf
+               echo "lose overstriping setting after instantiation"
+       }
+}
+run_test 27Ci "add an overstriping component"
+
 test_27D() {
        [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs"
        [ -n "$FILESET" ] && skip "SKIP due to FILESET set"