From 37e1316050c93e5233f77ebcd399a8272b989605 Mon Sep 17 00:00:00 2001 From: Alexandre Ioffe Date: Sat, 30 Mar 2024 13:55:24 -0700 Subject: [PATCH] LU-17685 utils: Allow nocompr flag in lfs mirror extend Extend the set of allowed optional flags in 'lfs mirror extend' command by LCME_FL_NOCOMPR. Allowed syntax: --flags=prefer --flags=nocompr --flags=prefer,nocompr Test-Parameters: trivial testlist=sanity-flr Signed-off-by: Alexandre Ioffe Change-Id: Id1538182eca0142464c19c0c4b1406592e615be1 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54640 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Artem Blagodarenko Reviewed-by: Oleg Drokin --- lustre/include/uapi/linux/lustre/lustre_user.h | 2 +- lustre/tests/sanity-flr.sh | 18 ++++++++++++++++-- lustre/utils/liblustreapi_layout.c | 3 ++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lustre/include/uapi/linux/lustre/lustre_user.h b/lustre/include/uapi/linux/lustre/lustre_user.h index 60f14b4..376c622 100644 --- a/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/lustre/include/uapi/linux/lustre/lustre_user.h @@ -937,7 +937,7 @@ enum lov_comp_md_entry_flags { LCME_FL_EXTENSION) /* The mirror flags can be set by users at creation time. */ -#define LCME_USER_MIRROR_FLAGS (LCME_FL_PREF_RW) +#define LCME_USER_MIRROR_FLAGS (LCME_FL_PREF_RW | LCME_FL_NOCOMPR) /* The allowed flags obtained from the client at component creation time. */ #define LCME_CL_COMP_FLAGS (LCME_USER_MIRROR_FLAGS | LCME_FL_EXTENSION) diff --git a/lustre/tests/sanity-flr.sh b/lustre/tests/sanity-flr.sh index 9c6c2cb..f570187 100644 --- a/lustre/tests/sanity-flr.sh +++ b/lustre/tests/sanity-flr.sh @@ -4132,12 +4132,26 @@ function test_205() { $LFS mirror extend -N --flags=prefer $tf mirrors=$($LFS getstripe $tf | grep lcme_mirror_id | wc -l ) - (( $mirrors == 3 )) || error "no new mirror was created?" + (( $mirrors == 3 )) || error "no new mirror with prefer flag was created?" $($LFS getstripe $tf | grep lcme_flags: | tail -1 | grep -q prefer) || error "prefer flag was not set on the new mirror" + + $LFS mirror extend -N --flags=nocompr $tf + mirrors=$($LFS getstripe $tf | grep lcme_mirror_id | wc -l ) + (( $mirrors == 4 )) || error "no new mirror with nocompr flag was created?" + + $($LFS getstripe $tf | grep lcme_flags: | tail -1 | grep -q nocompr) || + error "nocompr flag was not set on the new mirror" + + $LFS mirror extend -N --flags=prefer,nocompr $tf + mirrors=$($LFS getstripe $tf | grep lcme_mirror_id | wc -l ) + (( $mirrors == 5 )) || error "no new mirror with prefer,nocompr flags was created?" + + $($LFS getstripe $tf | grep lcme_flags: | tail -1 | grep -q "prefer,nocompr") || + error "prefer,nocompr flags were not set on the new mirror" } -run_test 205 "lfs mirror extend to set prefer flag" +run_test 205 "lfs mirror extend to set prefer and nocompr flags" function test_206() { # create a new OST pool diff --git a/lustre/utils/liblustreapi_layout.c b/lustre/utils/liblustreapi_layout.c index da74518..332af24 100644 --- a/lustre/utils/liblustreapi_layout.c +++ b/lustre/utils/liblustreapi_layout.c @@ -3642,7 +3642,8 @@ static int llapi_layout_sanity_cb(struct llapi_layout *layout, args->lsa_rc = LSE_FLAGS; } else { if (comp->llc_flags & - ~(LCME_FL_EXTENSION | LCME_FL_PREF_RW)) + ~(LCME_FL_EXTENSION | LCME_FL_PREF_RW | + LCME_FL_NOCOMPR)) args->lsa_rc = LSE_FLAGS; } } -- 1.8.3.1