From: Andreas Dilger Date: Thu, 30 May 2024 17:04:27 +0000 (-0600) Subject: EX-9708 utils: lfs setstripe adds -E with -Z X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=f50f99c4d6078c373532f3ecd5dd2da794739d40;p=fs%2Flustre-release.git EX-9708 utils: lfs setstripe adds -E with -Z When specifying a layout with "lfs setstripe -Z" it will ignore this option if no PFL component is specified with "-E". Instead, "lfs setstripe -Z" should automatically upgrade the file layout to a PFL layout so the compression parameters are saved. Test-Parameters: trivial testlist=sanity-compr Signed-off-by: Andreas Dilger Change-Id: I29cc373fabd352d6f8b6781c238806b75cce7057 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/55264 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Artem Blagodarenko --- diff --git a/lustre/tests/sanity-compr.sh b/lustre/tests/sanity-compr.sh index aa442ad..ed8d0c3 100644 --- a/lustre/tests/sanity-compr.sh +++ b/lustre/tests/sanity-compr.sh @@ -1219,6 +1219,21 @@ test_1008() { } run_test 1008 "validate directory space usage reduction with compression" +test_1014() { + (( MDS1_VERSION >= $(version_code 2.14.0-ddn128) )) || + skip "Need MDS version at least 2.14.0-ddn128" + $LFS setstripe -Z lz4:3 $DIR/$tfile || error "setstripe -Z failed" + $LFS setstripe -E eof -Z lz4:3 $DIR/$tfile.2 || + error "setstripe -E eof -Z failed" + $LFS getstripe -Z $DIR/$tfile + + local def=$($LFS getstripe -Z $DIR/$tfile) + local eof=$($LFS getstripe -Z $DIR/$tfile.2) + + [[ "$def" == "$eof" ]] || error "default '$def' != eof '$eof'" +} +run_test 1014 "add PFL for compressed layout" + test_1020() { (( MDS1_VERSION >= $(version_code 2.14.0-ddn128) )) || skip "Need MDS version at least 2.14.0-ddn128" @@ -1303,7 +1318,7 @@ test_1020() { # (( r_chunks == w_chunks )) || # error "num of chunks does not match. '$r_chunks' != '$w_chunks'" } -run_test 1020 "Сhecking compression counters" +run_test 1020 "Checking compression counters" test_1080() { (( MDS1_VERSION >= $(version_code 2.14.0-ddn128) )) || diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 0f75f73..12e5326 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -4273,11 +4273,6 @@ static int lfs_setstripe_internal(int argc, char **argv, break; case LFS_COMPRESS_TYPE_OPT: case 'Z': - if (layout == NULL && mirror_list == NULL && - lsa.lsa_comp_end == 0) - fprintf(stderr, - "WARNING: (-Z) option specified, however no layout defined (-E), compression feature will not be enabled.\n"); - result = llapi_parse_compress_type(optarg, &lsa.lsa_compr_type, &lsa.lsa_compr_lvl, @@ -4374,6 +4369,9 @@ static int lfs_setstripe_internal(int argc, char **argv, lsa.lsa_comp_end = LUSTRE_EOF; } + if (lsa.lsa_compr_type && !lsa.lsa_comp_end) + lsa.lsa_comp_end = LUSTRE_EOF; + if (lsa.lsa_comp_end != 0) { result = comp_args_to_layout(lpp, &lsa, true); if (result) {