From 587a54571e3ce1c39a1995a6d1ae7066e5459e24 Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Fri, 9 Jan 2015 10:58:39 -0600 Subject: [PATCH] LU-6081 lfs: split setstripe and migrate help 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 Change-Id: If8d110b04b26090d0540bb1628de75a94d92727e Reviewed-on: http://review.whamcloud.com/13317 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: Andreas Dilger --- lustre/utils/lfs.c | 56 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 9d51838..f137103 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -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 ]\n"\ - " [--stripe-index|-i ]\n"\ - " [--stripe-size|-S ]\n"\ - " [--pool|-p ]\n"\ - " [--block|-b] "_tgt"\n"\ - " [--ost-list|-o ]\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 ]\n" \ + " [--stripe-index|-i ]\n" \ + " [--stripe-size|-S ]\n" \ + " [--pool|-p ]\n" \ + " [--ost-list|-o ]\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 ,-,\n"\ - "\t Or:\n"\ - "\t -o -o - -o \n"\ - "\t If --pool is set with --ost-list, then the OSTs\n"\ + "\t Indices be specified in a format of:\n" \ + "\t -o ,-,\n" \ + "\t Or:\n" \ + "\t -o -o - -o \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") \ + " \n" \ + SSM_HELP_COMMON + +#define MIGRATE_USAGE \ + SSM_CMD_COMMON("migrate ") \ + " [--block|-b]\n" \ + " \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 (to delete default striping)\n"\ " or\n" - SETSTRIPE_USAGE("setstripe", "")}, + 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 "}, {"migrate", lfs_setstripe, 0, "migrate file from one OST layout to " "another (may be not safe with concurent writes).\n" - SETSTRIPE_USAGE("migrate ", "")}, + MIGRATE_USAGE}, {"mv", lfs_mv, 0, "To move directories between MDTs.\n" "usage: mv [--mdt-index|-M] " -- 1.8.3.1