From: Rajeev Mishra Date: Wed, 18 Dec 2024 05:16:11 +0000 (+0000) Subject: LU-18421 utils: Do not inherit stripe size from DOM component X-Git-Tag: 2.16.52~28 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=478dd88f38b77d3cd63c0f931d11b57a03c50928;p=fs%2Flustre-release.git LU-18421 utils: Do not inherit stripe size from DOM component When a DOM file is created with multiple components, the size of the first component is inherited by the other components if their sizes are not explicitly specified. This fix ensures that the size of subsequent components is set to the default size when no size is provided. New test added in sanity-dom.sh: Added test 8 to validate the creation of a default stripe size when no stripe size is explicitly specified. Modified test-- sanity-pfl.sh: modified 21b test so that stripe size is 1MB as test assumes 1MB size while doing find Test-Parameters: testlist=sanity-dom HPE-bug-id: LUS-12585 Signed-off-by: Rajeev Mishra Change-Id: I3388c289084769a96d8b87ae3a8268e5eb19a67e Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57501 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Patrick Farrell Reviewed-by: Mikhail Pershin Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity-dom.sh b/lustre/tests/sanity-dom.sh index 3666ef1..3434c97 100644 --- a/lustre/tests/sanity-dom.sh +++ b/lustre/tests/sanity-dom.sh @@ -168,6 +168,24 @@ test_7() { } run_test 7 "Stale pages after read-on-open" +test_8() { + local file=$DIR/$tdir/$tfile + local def_stripe_size + local stripe_size + + test_mkdir $DIR/$tdir + $LFS setstripe -E 128k -L mdt -E 8M -c 1 $file \ + || error "setstripe failed" + def_stripe_size=$($LFS getstripe -S $MOUNT) + stripe_size=$($LFS getstripe -S --component-start=131072 \ + --component-end=8388608 $file) + (($stripe_size == $def_stripe_size)) || + error "$f stripe size $stripe_size != $def_stripe_size" + rm -fr $DIR/$tdir +} +run_test 8 "verify the default size of component" + + test_fsx() { local file1=$DIR1/$tfile local file2=$DIR2/$tfile diff --git a/lustre/tests/sanity-pfl.sh b/lustre/tests/sanity-pfl.sh index 268f851..578bb27 100755 --- a/lustre/tests/sanity-pfl.sh +++ b/lustre/tests/sanity-pfl.sh @@ -1940,8 +1940,8 @@ test_21b() { test_mkdir -p $DIR/$tdir # DoM, extendable component, further extendable component - $LFS setstripe -E 1M -L mdt -E 256M -i 0 -z 64M -E -1 -z 128M \ - $comp_file || error "Create $comp_file failed" + $LFS setstripe -E 1M -L mdt -S 1M -E 256M -i 0 -z 64M -S 1M -E -1 \ + -z 128M $comp_file || error "Create $comp_file failed" found=$($LFS find --comp-start 1M -E 1M $flg_opts $comp_file | wc -l) [ $found -eq 1 ] || error "Write: Zero length component not found" diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index ad97fd5..e08a97d 100755 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -2914,7 +2914,10 @@ static inline void setstripe_args_init_inherit(struct lfs_setstripe_args *lsa) long long stripe_count; char *pool_name = NULL; - stripe_size = lsa->lsa_stripe_size; + if (lsa->lsa_pattern == LLAPI_LAYOUT_MDT) + stripe_size = LLAPI_LAYOUT_DEFAULT; + else + stripe_size = lsa->lsa_stripe_size; stripe_count = lsa->lsa_stripe_count; pool_name = lsa->lsa_pool_name;