From: Andreas Dilger Date: Fri, 18 Jan 2019 02:44:39 +0000 (-0500) Subject: LU-930 utils: fix --verbose option for lfs-migrate.1 X-Git-Tag: 2.12.52~66 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=ed04ce44b1d434af9a36f50f1898e9a5417a7a6f;hp=fa3b858d5c5b9124591e05a5dcdd98a3ee3619c6 LU-930 utils: fix --verbose option for lfs-migrate.1 Fix the "lfs migrate --verbose" option. Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: I66c02926023fd3f08ddb6d5d10ee5836b83ebbe5 Reviewed-on: https://review.whamcloud.com/34075 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Joseph Gmitter Reviewed-by: Oleg Drokin --- diff --git a/lustre/doc/lfs-migrate.1 b/lustre/doc/lfs-migrate.1 index 1f036df..3e30ccc 100644 --- a/lustre/doc/lfs-migrate.1 +++ b/lustre/doc/lfs-migrate.1 @@ -3,7 +3,9 @@ lfs migrate \- migrate files or directories between MDTs or OSTs. .SH SYNOPSIS .B lfs migrate -.RI [ SETSTRIPE_OPTIONS " ... ] <" file "> ..." +.RI [ SETSTRIPE_OPTIONS " ... ]" +.RB [ -v ] +.RI < file "> ..." .br .B lfs migrate -m \fIstart_mdt_index .RB [ -cHv ] @@ -64,6 +66,9 @@ write operations synchronous. Using the .B --non-direct option uses buffered read/write operations, which may improve migration speed at the cost of more CPU and memory overhead. +.TP +.BR -v , --verbose +Print each filename as it is migrated. .P NOTE: .B lfs migrate diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 6225437..089284d 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -234,15 +234,15 @@ static inline int lfs_mirror_split(int argc, char **argv) #define MIGRATE_USAGE \ SSM_CMD_COMMON("migrate ") \ - " [--block|-b]\n" \ - " [--non-block|-n]\n" \ - " [--non-direct|-D]\n" \ + " [--block|-b] [--non-block|-n]\n" \ + " [--non-direct|-D] [--verbose|-v]\n" \ " \n" \ SSM_HELP_COMMON \ "\n" \ "\tblock: Block file access during data migration (default)\n" \ "\tnon-block: Abort migrations if concurrent access is detected\n" \ - "\tnon-direct: Do not use direct I/O to copy file contents\n" \ + "\tnon-direct: Do not use direct I/O to copy file contents\n" \ + "\tverbose: Print each filename as it is migrated\n" \ #define SETDIRSTRIPE_USAGE \ " [--mdt-count|-c stripe_count>\n" \ @@ -625,9 +625,10 @@ static int check_hashtype(const char *hashtype) static const char *error_loc = "syserror"; enum { - MIGRATION_NONBLOCK = 1 << 0, - MIGRATION_MIRROR = 1 << 1, - MIGRATION_NONDIRECT = 1 << 2, + MIGRATION_NONBLOCK = 0x0001, + MIGRATION_MIRROR = 0x0002, + MIGRATION_NONDIRECT = 0x0004, + MIGRATION_VERBOSE = 0x0008, }; static int lfs_component_create(char *fname, int open_flags, mode_t open_mode, @@ -1129,6 +1130,9 @@ out: if (rc < 0) fprintf(stderr, "error: %s: %s: %s: %s\n", progname, name, error_loc, strerror(-rc)); + else if (migration_flags & MIGRATION_VERBOSE) + printf("%s\n", name); + return rc; } @@ -3024,6 +3028,7 @@ static int lfs_setstripe_internal(int argc, char **argv, goto usage_error; } migrate_mdt_param.fp_verbose = VERBOSE_DETAIL; + migration_flags = MIGRATION_VERBOSE; break; case 'y': from_yaml = true;