From a0ca91680f54e9bf2804181b99a5421ecd333d77 Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Tue, 1 Dec 2015 21:54:07 -0800 Subject: [PATCH] =?utf8?q?LU-7503=20utils:=20add=20=E2=80=9C--verbose|-v?= =?utf8?q?=E2=80=9D=20option=20to=20=E2=80=9Clfs=20migrate=20-m=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit “lfs mv” has -v option to track the migration progress, which is very useful for migrating big directory. However, the option is missing while we changing “lfs mv” to “lfs migrate -m” in commit 849d7d5b1b4cabb7578c3ab5aaf271e90dd33864. This patch adds the option. Signed-off-by: Jian Yu Change-Id: I0729f74f46943736c6ed6ade46ca26aee905f550 Reviewed-on: http://review.whamcloud.com/17420 Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Lai Siyao --- lustre/utils/lfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index b08bbea..e5370e9 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -358,7 +358,8 @@ command_t cmdlist[] = { {"migrate", lfs_setstripe, 0, "migrate file/directory between MDTs, or migrate file from one OST " "layout\nto another (may be not safe with concurent writes).\n" - "usage: migrate [--mdt-index|-m ] ]\n" + "usage: migrate [--mdt-index|-m ] [--verbose|-v] " + "\n" "\tmdt_idx: MDT index to migrate to\n" " or\n" MIGRATE_USAGE}, @@ -941,6 +942,8 @@ static int lfs_setstripe(int argc, char **argv) #endif {"stripe-size", required_argument, 0, 'S'}, {"stripe_size", required_argument, 0, 'S'}, + /* --verbose is only valid in migrate mode */ + {"verbose", no_argument, 0, 'v'}, {0, 0, 0, 0} }; @@ -951,7 +954,7 @@ static int lfs_setstripe(int argc, char **argv) if (strcmp(argv[0], "migrate") == 0) migrate_mode = true; - while ((c = getopt_long(argc, argv, "bc:di:m:no:p:s:S:", + while ((c = getopt_long(argc, argv, "bc:di:m:no:p:s:S:v", long_opts, NULL)) >= 0) { switch (c) { case 0: @@ -1028,6 +1031,14 @@ static int lfs_setstripe(int argc, char **argv) case 'p': pool_name_arg = optarg; break; + case 'v': + if (!migrate_mode) { + fprintf(stderr, "--verbose is valid only for" + " migrate mode\n"); + return CMD_HELP; + } + migrate_mdt_param.fp_verbose = VERBOSE_DETAIL; + break; default: return CMD_HELP; } -- 1.8.3.1