From 88d8f0f86bd4994e07aa12bd00cbc7ad3192205c Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Sun, 27 Jan 2019 11:23:48 -0700 Subject: [PATCH] LU-11891 utils: getstripe use --mdt-index consistently LU-10856 fixed most usages of "warning: '-M' deprecated, use '--mdt-index' or '-m' instead" but missed a few in cases in sanity test_271d, test_271e, and test_271f. Fix those tests to use "--mdt-index". Also, lfs has a few places were the usage of "--mdt-index" and "--mdt" is inconsistent. Fix those options to be used consistently across all commands. Fixes: 6c617a3d56 ("LU-10856 tests: remove deprecated lfs ...") Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: I013b2198f3a39533da9a0067a0bf5846604b3052 Reviewed-on: https://review.whamcloud.com/34116 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: James Nunez Reviewed-by: Oleg Drokin --- lustre/tests/sanity.sh | 6 +++--- lustre/utils/lfs.c | 28 ++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index b4c5e0e..0b7eea3 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -17432,7 +17432,7 @@ test_271d() { $LFS setstripe -E 1024K -L mdt $DIR/$tdir - local mdtidx=$($LFS getstripe -M $DIR/$tdir) + local mdtidx=$($LFS getstripe --mdt-index $DIR/$tdir) cancel_lru_locks mdc dd if=/dev/urandom of=$tmp bs=1000 count=1 @@ -17488,7 +17488,7 @@ test_271e() { $LFS setstripe -E 1024K -L mdt $DIR/$tdir - local mdtidx=$($LFS getstripe -M $DIR/$tdir) + local mdtidx=$($LFS getstripe --mdt-index $DIR/$tdir) cancel_lru_locks mdc dd if=/dev/urandom of=$tmp bs=30K count=1 @@ -17543,7 +17543,7 @@ test_271f() { $LFS setstripe -E 1024K -L mdt $DIR/$tdir - local mdtidx=$($LFS getstripe -M $DIR/$tdir) + local mdtidx=$($LFS getstripe --mdt-index $DIR/$tdir) cancel_lru_locks mdc dd if=/dev/urandom of=$tmp bs=200000 count=1 diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index fd944b6..3fe36f2 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -246,16 +246,16 @@ static inline int lfs_mirror_split(int argc, char **argv) #define SETDIRSTRIPE_USAGE \ " [--mdt-count|-c stripe_count>\n" \ - " [--mdt-index|-i mdt_index[,mdt_index,...]\n" \ " [--mdt-hash|-H mdt_hash]\n" \ - " [--default|-D] [--mode|-m mode] \n" \ + " [--mdt-index|-i mdt_index[,mdt_index,...]\n" \ + " [--default|-D] [--mode|-o mode] \n" \ "\tstripe_count: stripe count of the striped directory\n" \ "\tmdt_index: MDT index of first stripe\n" \ "\tmdt_hash: hash type of the striped directory. mdt types:\n" \ " fnv_1a_64 FNV-1a hash algorithm (default)\n" \ " all_char sum of characters % MDT_COUNT (not recommended)\n" \ "\tdefault_stripe: set default dirstripe of the directory\n" \ - "\tmode: the mode of the directory\n" + "\tmode: the file access permission of the directory (octal)\n" /** * command_t mirror_cmdlist - lfs mirror commands. @@ -383,7 +383,6 @@ command_t cmdlist[] = { "usage: find ...\n" " [[!] --atime|-A [+-]N] [[!] --ctime|-C [+-]N]\n" " [[!] --mtime|-M [+-]N] [--maxdepth|-D N] [[!] --blocks|-b N]\n" - " [[!] --mdt-index|--mdt|-m ]\n" " [[!] --name|-n ] [[!] --ost|-O ]\n" " [--print|-P] [--print0|-0] [[!] --size|-s [+-]N[bkMGTPE]]\n" " [[!] --stripe-count|-c [+-]]\n" @@ -401,6 +400,7 @@ command_t cmdlist[] = { " [[!] --mirror-state <[^]state>]\n" " [[!] --mdt-count|-T [+-]]\n" " [[!] --mdt-hash|-H \n" + " [[!] --mdt-index|-m ]\n" "\t !: used before an option indicates 'NOT' requested attribute\n" "\t -: used before a value indicates less than requested value\n" "\t +: used before a value indicates more than requested value\n" @@ -541,9 +541,9 @@ command_t cmdlist[] = { "usage: swap_layouts "}, {"migrate", lfs_setstripe_migrate, 0, "migrate a directory between MDTs.\n" - "usage: migrate [--mdt|-m] \n" - " [--mdt-count|-c] \n" + "usage: migrate [--mdt-count|-c] \n" " [--mdt-hash|-H] \n" + " [--mdt-index|-m] \n" " [--verbose|-v]\n" " \n" "\tmdt: MDTs to stripe over, if only one MDT is specified\n" @@ -2920,7 +2920,7 @@ static int lfs_setstripe_internal(int argc, char **argv, case 'm': if (!migrate_mode) { fprintf(stderr, - "%s %s: -m|--mdt is valid only for migrate command\n", + "%s %s: -m|--mdt-index is valid only for migrate command\n", progname, argv[0]); goto usage_error; } @@ -4956,7 +4956,13 @@ static int lfs_setdirstripe(int argc, char **argv) { .val = 'D', .name = "default", .has_arg = no_argument }, { .val = 'D', .name = "default_stripe", .has_arg = no_argument }, { .val = 'H', .name = "mdt-hash", .has_arg = required_argument }, +#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 17, 53, 0) { .val = 'i', .name = "mdt-index", .has_arg = required_argument }, + { .val = 'i', .name = "mdt", .has_arg = required_argument }, +#else + { .val = 'm', .name = "mdt-index", .has_arg = required_argument }, + { .val = 'm', .name = "mdt", .has_arg = required_argument }, +#endif #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) { .val = 'i', .name = "index", .has_arg = required_argument }, #endif @@ -5008,6 +5014,11 @@ static int lfs_setdirstripe(int argc, char **argv) } break; case 'i': +#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 17, 53, 0) + case 'm': +#endif + fprintf(stderr, "warning: '-m' is deprecated, " + "use '--mode' or '-o' instead\n"); #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) if (strcmp(argv[optind - 1], "--index") == 0) fprintf(stderr, @@ -5028,7 +5039,7 @@ static int lfs_setdirstripe(int argc, char **argv) if (lsa.lsa_stripe_off == LLAPI_LAYOUT_DEFAULT) lsa.lsa_stripe_off = mdts[0]; break; -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 16, 53, 0) +#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 15, 53, 0) case 'm': fprintf(stderr, "warning: '-m' is deprecated, " "use '--mode' or '-o' instead\n"); @@ -5273,6 +5284,7 @@ static int lfs_mv(int argc, char **argv) int c; int rc = 0; struct option long_opts[] = { + { .val = 'm', .name = "mdt", .has_arg = required_argument }, { .val = 'm', .name = "mdt-index", .has_arg = required_argument }, { .val = 'v', .name = "verbose", .has_arg = no_argument }, { .name = NULL } }; -- 1.8.3.1