SSM_CMD_COMMON("migrate ") \
" [--block|-b]\n" \
" [--non-block|-n]\n" \
+ " [--non-direct|-D]\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" \
#define SETDIRSTRIPE_USAGE \
" [--mdt-count|-c stripe_count>\n" \
" [--ost|-o] <ost_indices>\n"
" [--block|-b]\n"
" [--non-block|-n]\n"
+ " [--non-direct|-D]\n"
" <file|directory>\n"
"\tstripe_count: number of OSTs to stripe a file over\n"
"\tstripe_ost_index: index of the first OST to stripe a file over\n"
"\tpool_name: name of the predefined pool of OSTs\n"
"\tost_indices: OSTs to stripe over, in order\n"
"\tblock: wait for the operation to return before continuing\n"
- "\tnon-block: do not wait for the operation to return.\n"},
+ "\tnon-block: do not wait for the operation to return\n"
+ "\tnon-direct: do not use direct I/O to copy file contents.\n"},
{"mv", lfs_mv, 0,
"To move directories between MDTs. This command is deprecated, "
"use \"migrate\" instead.\n"
enum {
MIGRATION_NONBLOCK = 1 << 0,
MIGRATION_MIRROR = 1 << 1,
+ MIGRATION_NONDIRECT = 1 << 2,
};
static int lfs_component_create(char *fname, int open_flags, mode_t open_mode,
struct llapi_layout *layout);
static int
-migrate_open_files(const char *name, const struct llapi_stripe_param *param,
+migrate_open_files(const char *name, __u64 migration_flags,
+ const struct llapi_stripe_param *param,
struct llapi_layout *layout, int *fd_src, int *fd_tgt)
{
int fd = -1;
int fdv = -1;
+ int rflags;
int mdt_index;
int random_value;
char parent[PATH_MAX];
/* open file, direct io */
/* even if the file is only read, WR mode is nedeed to allow
* layout swap on fd */
- fd = open(name, O_RDWR | O_DIRECT);
+ rflags = O_RDWR;
+ if (!(migration_flags & MIGRATION_NONDIRECT))
+ rflags |= O_DIRECT;
+ fd = open(name, rflags);
if (fd < 0) {
rc = -errno;
error_loc = "cannot open source file";
int fdv = -1;
int rc;
- rc = migrate_open_files(name, param, layout, &fd, &fdv);
+ rc = migrate_open_files(name, migration_flags, param, layout,
+ &fd, &fdv);
if (rc < 0)
goto out;
int fdv = -1;
int rc;
- rc = migrate_open_files(name, NULL, layout, &fd, &fdv);
+ rc = migrate_open_files(name, 0, NULL, layout, &fd, &fdv);
if (rc < 0)
goto out;
/* find { .val = 'C', .name = "ctime", .has_arg = required_argument }*/
{ .val = 'd', .name = "delete", .has_arg = no_argument},
{ .val = 'd', .name = "destroy", .has_arg = no_argument},
+ /* --non-direct is only valid in migrate mode */
+ { .val = 'D', .name = "non-direct", .has_arg = no_argument },
{ .val = 'E', .name = "comp-end", .has_arg = required_argument},
{ .val = 'E', .name = "component-end",
.has_arg = required_argument},
snprintf(cmd, sizeof(cmd), "%s %s", progname, argv[0]);
progname = cmd;
- while ((c = getopt_long(argc, argv, "bc:dE:f:i:I:m:N::no:p:L:s:S:v",
+ while ((c = getopt_long(argc, argv, "bc:dDE:f:i:I:m:N::no:p:L:s:S:v",
long_opts, NULL)) >= 0) {
switch (c) {
case 0:
mirror_flags |= MF_DESTROY;
}
break;
+ case 'D':
+ if (!migrate_mode) {
+ fprintf(stderr,
+ "%s %s: -D|--non-direct is valid "
+ "only for migrate command\n",
+ progname, argv[0]);
+ goto usage_error;
+ }
+ migration_flags |= MIGRATION_NONDIRECT;
+ break;
case 'E':
if (lsa.lsa_comp_end != 0) {
result = comp_args_to_layout(lpp, &lsa);