Whamcloud - gitweb
LU-930 utils: fix --verbose option for lfs-migrate.1 75/34075/2
authorAndreas Dilger <adilger@whamcloud.com>
Fri, 18 Jan 2019 02:44:39 +0000 (21:44 -0500)
committerOleg Drokin <green@whamcloud.com>
Mon, 18 Feb 2019 06:38:31 +0000 (06:38 +0000)
Fix the "lfs migrate --verbose" option.

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I66c02926023fd3f08ddb6d5d10ee5836b83ebbe5
Reviewed-on: https://review.whamcloud.com/34075
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Joseph Gmitter <jgmitter@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/doc/lfs-migrate.1
lustre/utils/lfs.c

index 1f036df..3e30ccc 100644 (file)
@@ -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
index 6225437..089284d 100644 (file)
@@ -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"           \
        "                 <filename>\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;