From 3e1dd9d6aeb0cf1898e703f8d0104c8c2490b56c Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Thu, 25 Jan 2024 01:08:33 +0800 Subject: [PATCH] LU-17468 lod: component add missed pattern info "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 Change-Id: I7ad746a550f1afea54a6f5b68823a79a85a44082 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53811 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Sebastien Buisson Reviewed-by: Andreas Dilger --- lustre/lod/lod_object.c | 2 +- lustre/tests/sanity-compr.sh | 16 ++++++++++++++++ lustre/tests/sanity.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 0867783..94aefca 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -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 = diff --git a/lustre/tests/sanity-compr.sh b/lustre/tests/sanity-compr.sh index 7055637..6e38b70 100644 --- a/lustre/tests/sanity-compr.sh +++ b/lustre/tests/sanity-compr.sh @@ -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 diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 5dfbaa2..9cb3a42 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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" -- 1.8.3.1