From 986fe589f9727d52cfa2350ffbaeea0cae94f3d5 Mon Sep 17 00:00:00 2001 From: Emoly Liu Date: Fri, 5 Jun 2020 11:39:37 +0800 Subject: [PATCH] LU-13635 lfs: add -D option back to lfs_migrate Enable "-D" option with its long option "--non-direct" correctly in lfs_migrate. sanity.sh test_56we is added to verify this patch. Test-Parameters: trivial Signed-off-by: Emoly Liu Change-Id: I6ab051c0f2e0cde9de6a5b8ace8962cc293e7656 Reviewed-on: https://review.whamcloud.com/38840 Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- lustre/scripts/lfs_migrate | 5 ++--- lustre/tests/sanity.sh | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lustre/scripts/lfs_migrate b/lustre/scripts/lfs_migrate index 6e78e99..f410840 100755 --- a/lustre/scripts/lfs_migrate +++ b/lustre/scripts/lfs_migrate @@ -121,7 +121,6 @@ OPT_PASSTHROUGH=() OPT_POOL="" OPT_RESTRIPE=false OPT_YES=false -LFS_OPT_DIRECTIO="" OPT_AUTOSTRIPE=false OPT_STRIPE_COUNT="" OPT_STRIPE_SIZE="" @@ -147,7 +146,7 @@ while [ -n "$*" ]; do -v|--verbose) OPT_DEBUG=true; ECHO=echo;; -y|--yes) OPT_YES=true;; -0) OPT_NULL=true;; - -b|--block|--non-block|--non-direct|--no-verify) + -b|--block|--non-block|--non-direct|-D|--no-verify) # Always pass non-layout options to 'lfs migrate' OPT_PASSTHROUGH+=("$arg");; --rsync) OPT_RSYNC=true;; @@ -157,7 +156,6 @@ while [ -n "$*" ]; do OPT_LAYOUT+="$arg $2 "; shift;; --auto-stripe|-A) OPT_AUTOSTRIPE=true;; -C) OPT_CAP="$2"; shift;; - -D) LFS_OPT_DIRECTIO="-D";; -M|--min-free) OPT_MINFREE="$2"; shift;; -X|--max-free) OPT_MAXFREE="$2"; shift;; -c|--stripe-count) OPT_STRIPE_COUNT="$2"; shift;; @@ -483,6 +481,7 @@ lfs_migrate() { # first try to migrate via Lustre tools, then fall back to rsync if ! $OPT_RSYNC; then + $OPT_DEBUG && echo -e "\n$LFS migrate $layout $OLDNAME" if $LFS migrate $layout "$OLDNAME"; then $ECHO "done" # no-op if hlinks empty for 1-link files diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 1e10a42..ac3f1aa 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -6796,6 +6796,24 @@ test_56wd() { } run_test 56wd "check lfs_migrate --rsync and --no-rsync work" +test_56we() { + local td=$DIR/$tdir + local tf=$td/$tfile + + test_mkdir $td || error "cannot create $td" + touch $tf || error "cannot touch $tf" + + echo -n "Make sure --non-direct|-D works..." + $LFS_MIGRATE -y --non-direct -v $tf 2>&1 | + grep -q "lfs migrate --non-direct" || + error "--non-direct option cannot work correctly" + $LFS_MIGRATE -y -D -v $tf 2>&1 | + grep -q "lfs migrate -D" || + error "-D option cannot work correctly" + echo "done." +} +run_test 56we "check lfs_migrate --non-direct|-D support" + test_56x() { [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs" check_swap_layouts_support -- 1.8.3.1