Whamcloud - gitweb
LU-6081 lfs: split setstripe and migrate help 17/13317/8
authorFrank Zago <fzago@cray.com>
Fri, 9 Jan 2015 16:58:39 +0000 (10:58 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 27 Mar 2015 15:27:39 +0000 (15:27 +0000)
The setstripe and migrate share all but one of their parameters
(--block). However the help is common to both, so the --block also
appears for the setstripe command but is not valid. So split the help
message for each command, while still sharing the same text to avoid
duplication.

Signed-off-by: frank zago <fzago@cray.com>
Change-Id: If8d110b04b26090d0540bb1628de75a94d92727e
Reviewed-on: http://review.whamcloud.com/13317
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/utils/lfs.c

index 9d51838..f137103 100644 (file)
@@ -115,28 +115,42 @@ static int lfs_hsm_cancel(int argc, char **argv);
 static int lfs_swap_layouts(int argc, char **argv);
 static int lfs_mv(int argc, char **argv);
 
-#define SETSTRIPE_USAGE(_cmd, _tgt) \
-       "usage: "_cmd" [--stripe-count|-c <stripe_count>]\n"\
-       "                 [--stripe-index|-i <start_ost_idx>]\n"\
-       "                 [--stripe-size|-S <stripe_size>]\n"\
-       "                 [--pool|-p <pool_name>]\n"\
-       "                 [--block|-b] "_tgt"\n"\
-       "                 [--ost-list|-o <ost_indices>]\n"\
-       "\tstripe_size:  Number of bytes on each OST (0 filesystem default)\n"\
-       "\t              Can be specified with k, m or g (in KB, MB and GB\n"\
-       "\t              respectively)\n"\
-       "\tstart_ost_idx: OST index of first stripe (-1 default)\n"\
-       "\tstripe_count: Number of OSTs to stripe over (0 default, -1 all)\n"\
-       "\tpool_name:    Name of OST pool to use (default none)\n"\
-       "\tblock:        Block file access during data migration\n"\
+/* Setstripe and migrate share mostly the same parameters */
+#define SSM_CMD_COMMON(cmd) \
+       "usage: "cmd" [--stripe-count|-c <stripe_count>]\n"             \
+       "                 [--stripe-index|-i <start_ost_idx>]\n"        \
+       "                 [--stripe-size|-S <stripe_size>]\n"           \
+       "                 [--pool|-p <pool_name>]\n"                    \
+       "                 [--ost-list|-o <ost_indices>]\n"
+
+#define SSM_HELP_COMMON \
+       "\tstripe_size:  Number of bytes on each OST (0 filesystem default)\n" \
+       "\t              Can be specified with k, m or g (in KB, MB and GB\n" \
+       "\t              respectively)\n"                               \
+       "\tstart_ost_idx: OST index of first stripe (-1 default)\n"     \
+       "\tstripe_count: Number of OSTs to stripe over (0 default, -1 all)\n" \
+       "\tpool_name:    Name of OST pool to use (default none)\n"      \
        "\tost_indices:  List of OST indices, can be repeated multiple times\n"\
-       "\t              Indices be specified in a format of:\n"\
-       "\t                -o <ost_1>,<ost_i>-<ost_j>,<ost_n>\n"\
-       "\t              Or:\n"\
-       "\t                -o <ost_1> -o <ost_i>-<ost_j> -o <ost_n>\n"\
-       "\t              If --pool is set with --ost-list, then the OSTs\n"\
+       "\t              Indices be specified in a format of:\n"        \
+       "\t                -o <ost_1>,<ost_i>-<ost_j>,<ost_n>\n"        \
+       "\t              Or:\n"                                         \
+       "\t                -o <ost_1> -o <ost_i>-<ost_j> -o <ost_n>\n"  \
+       "\t              If --pool is set with --ost-list, then the OSTs\n" \
        "\t              must be the members of the pool."
 
+#define SETSTRIPE_USAGE                                                \
+       SSM_CMD_COMMON("setstripe")                             \
+       "                 <directory|filename>\n"               \
+       SSM_HELP_COMMON
+
+#define MIGRATE_USAGE                                                  \
+       SSM_CMD_COMMON("migrate  ")                                     \
+       "                 [--block|-b]\n"                               \
+       "                 <filename>\n"                                 \
+       SSM_HELP_COMMON                                                 \
+       "\n"                                                            \
+       "\tblock:        Block file access during data migration\n"     \
+
 /* all avaialable commands */
 command_t cmdlist[] = {
        {"setstripe", lfs_setstripe, 0,
@@ -145,7 +159,7 @@ command_t cmdlist[] = {
         "delete the default striping pattern from an existing directory\n"
         "usage: setstripe -d <directory>   (to delete default striping)\n"\
         " or\n"
-        SETSTRIPE_USAGE("setstripe", "<directory|filename>")},
+        SETSTRIPE_USAGE},
        {"getstripe", lfs_getstripe, 0,
         "To list the striping info for a given file or files in a\n"
         "directory or recursively for all files in a directory tree.\n"
@@ -340,7 +354,7 @@ command_t cmdlist[] = {
         "usage: swap_layouts <path1> <path2>"},
        {"migrate", lfs_setstripe, 0, "migrate file from one OST layout to "
         "another (may be not safe with concurent writes).\n"
-        SETSTRIPE_USAGE("migrate  ", "<filename>")},
+        MIGRATE_USAGE},
        {"mv", lfs_mv, 0,
         "To move directories between MDTs.\n"
         "usage: mv <directory|filename> [--mdt-index|-M] <mdt_index> "