" [--stripe-count|-c <stripe_count>]\n" \
" [--stripe-index|-i <start_ost_idx>]\n" \
" [--stripe-size|-S <stripe_size>]\n" \
- " [--layout|-L <pattern>]\n" \
+ " [--layout|-L <pattern>]\n" \
" [--pool|-p <pool_name>]\n" \
" [--ost|-o <ost_indices>]\n" \
- " [--yaml|-y <yaml_template_file>]\n"
+ " [--yaml|-y <yaml_template_file>]\n" \
+ " [--copy=<lustre_src>]\n"
#define SSM_HELP_COMMON \
"\tstripe_count: Number of OSTs to stripe over (0=fs default, -1 all)\n" \
"\t stripe_size.\n" \
"\tyaml_template_file:\n" \
"\t YAML layout template file, can't be used with -c,\n" \
- "\t -i, -S, -p, -o, or -E arguments.\n"
+ "\t -i, -S, -p, -o, or -E arguments.\n" \
+ "\tlustre_src: Lustre file/dir whose layout info is used to set\n" \
+ "\t another lustre file or directory, can't used with\n" \
+ "\t -c, -i, -S, -p, -o, or -E arguments.\n"
#define MIRROR_CREATE_HELP \
"\tmirror_count: Number of mirrors to be created with the upcoming\n" \
"find files matching given attributes recursively in directory tree.\n"
"usage: find <directory|filename> ...\n"
" [[!] --atime|-A [+-]N] [[!] --ctime|-C [+-]N]\n"
- " [[!] --mtime|-M [+-]N] [--maxdepth|-D N]\n"
+ " [[!] --mtime|-M [+-]N] [--maxdepth|-D N] [[!] --blocks|-b N]\n"
" [[!] --mdt-index|--mdt|-m <uuid|index,...>]\n"
" [[!] --name|-n <pattern>] [[!] --ost|-O <uuid|index,...>]\n"
" [--print|-P] [--print0|-0] [[!] --size|-s [+-]N[bkMGTPE]]\n"
goto error;
}
- rc = lfs_component_create(fname, O_CREAT | O_WRONLY, 0644,
+ rc = lfs_component_create(fname, O_CREAT | O_WRONLY, 0666,
layout);
if (rc >= 0) {
close(rc);
LFS_MIRROR_FLAGS_OPT,
LFS_MIRROR_ID_OPT,
LFS_MIRROR_STATE_OPT,
+ LFS_LAYOUT_COPY,
};
/* functions */
__u16 mirror_id = 0;
char cmd[PATH_MAX];
bool from_yaml = false;
+ bool from_copy = false;
char *template = NULL;
struct option long_opts[] = {
.name = "flags", .has_arg = required_argument},
{ .val = LFS_MIRROR_ID_OPT,
.name = "mirror-id", .has_arg = required_argument},
+ { .val = LFS_LAYOUT_COPY,
+ .name = "copy", .has_arg = required_argument},
{ .val = 'c', .name = "stripe-count", .has_arg = required_argument},
{ .val = 'c', .name = "stripe_count", .has_arg = required_argument},
/* find { .val = 'C', .name = "ctime", .has_arg = required_argument }*/
}
break;
}
+ case LFS_LAYOUT_COPY:
+ from_copy = true;
+ template = optarg;
+ break;
case 'b':
if (!migrate_mode) {
fprintf(stderr,
goto error;
}
- if (from_yaml && (setstripe_args_specified(&lsa) || layout != NULL)) {
+ if (from_yaml && from_copy) {
+ fprintf(stderr,
+ "%s: can't specify --yaml and --copy together\n",
+ progname);
+ goto error;
+ }
+
+ if ((from_yaml || from_copy) &&
+ (setstripe_args_specified(&lsa) || layout != NULL)) {
fprintf(stderr, "error: %s: can't specify --yaml with "
"-c, -S, -i, -o, -p or -E options.\n",
argv[0]);
argv[0], template);
goto error;
}
+ } else if (from_copy) {
+ layout = llapi_layout_get_by_path(template, 0);
+ if (layout == NULL) {
+ fprintf(stderr,
+ "%s: can't create composite layout from file %s.\n",
+ progname, template);
+ goto error;
+ }
}
for (fname = argv[optind]; fname != NULL; fname = argv[++optind]) {
NULL);
} else if (layout != NULL) {
result = lfs_component_create(fname, O_CREAT | O_WRONLY,
- 0644, layout);
+ 0666, layout);
if (result >= 0) {
close(result);
result = 0;
} else {
result = llapi_file_open_param(fname,
O_CREAT | O_WRONLY,
- 0644, param);
+ 0666, param);
if (result >= 0) {
close(result);
result = 0;
};
struct option long_opts[] = {
{ .val = 'A', .name = "atime", .has_arg = required_argument },
+ { .val = 'b', .name = "blocks", .has_arg = required_argument },
{ .val = LFS_COMP_COUNT_OPT,
.name = "comp-count", .has_arg = required_argument },
{ .val = LFS_COMP_COUNT_OPT,
/* when getopt_long_only() hits '!' it returns 1, puts "!" in optarg */
while ((c = getopt_long_only(argc, argv,
- "-0A:c:C:D:E:g:G:H:i:L:m:M:n:N:O:Ppqrs:S:t:T:u:U:v",
+ "-0A:b:c:C:D:E:g:G:H:i:L:m:M:n:N:O:Ppqrs:S:t:T:u:U:v",
long_opts, NULL)) >= 0) {
xtime = NULL;
xsign = NULL;
if (rc)
*xsign = rc;
break;
+ case 'b':
+ if (optarg[0] == '+') {
+ param.fp_blocks_sign = -1;
+ optarg++;
+ } else if (optarg[0] == '-') {
+ param.fp_blocks_sign = 1;
+ optarg++;
+ }
+
+ param.fp_blocks_units = 1024;
+ ret = llapi_parse_size(optarg, ¶m.fp_blocks,
+ ¶m.fp_blocks_units, 0);
+ if (ret) {
+ fprintf(stderr, "error: bad blocks '%s'\n",
+ optarg);
+ goto err;
+ }
+ param.fp_check_blocks = 1;
+ param.fp_exclude_blocks = !!neg_opt;
+ break;
case LFS_COMP_COUNT_OPT:
if (optarg[0] == '+') {
param.fp_comp_count_sign = -1;
{
struct option long_opts[] = {
/* find { .val = 'A', .name = "atime", .has_arg = required_argument }*/
+/* find { .val = 'b', .name = "blocks", .has_arg = required_argument }*/
{ .val = LFS_COMP_COUNT_OPT,
.name = "comp-count", .has_arg = no_argument },
{ .val = LFS_COMP_COUNT_OPT,
if (rc1 && !rc)
rc = rc1;
}
+ return rc;
/* lfs quota -u username /path/to/lustre/mount */
} else if (qctl.qc_cmd == LUSTRE_Q_GETQUOTA) {
/* options should be followed by u/g-name and mntpoint */
return CMD_HELP;
}
}
- mnt = argv[optind];
- rc = get_print_quota(mnt, name, &qctl, verbose, quiet,
- human_readable);
} else if (optind + 1 != argc || qctl.qc_type == ALLQUOTA) {
fprintf(stderr, "%s quota: missing quota info argument(s)\n",
progname);
return CMD_HELP;
}
+ mnt = argv[optind];
+ rc = get_print_quota(mnt, name, &qctl, verbose, quiet,
+ human_readable);
return rc;
}
#endif /* HAVE_SYS_QUOTA_H! */
case 'f':
follow++;
break;
- case '?':
- return CMD_HELP;
default:
- fprintf(stderr, "error: %s: option '%s' unrecognized\n",
- argv[0], argv[optind - 1]);
+ fprintf(stderr,
+ "%s changelog: unrecognized option '%s'\n",
+ progname, argv[optind - 1]);
return CMD_HELP;
}
}
- if (optind >= argc)
- return CMD_HELP;
+ if (optind >= argc) {
+ fprintf(stderr, "%s changelog: mdtname must be specified\n",
+ progname);
+ return CMD_HELP;
+ }
mdd = argv[optind++];
if (argc > optind)
(follow ? CHANGELOG_FLAG_FOLLOW : 0),
mdd, startrec);
if (rc < 0) {
- fprintf(stderr, "Can't start changelog: %s\n",
- strerror(errno = -rc));
+ fprintf(stderr, "%s changelog: cannot start changelog: %s\n",
+ progname, strerror(errno = -rc));
return rc;
}
CHANGELOG_EXTRA_FLAG_OMODE |
CHANGELOG_EXTRA_FLAG_XATTR);
if (rc < 0) {
- fprintf(stderr, "Can't set xflags for changelog: %s\n",
- strerror(errno = -rc));
+ fprintf(stderr,
+ "%s changelog: cannot set xflags for changelog: %s\n",
+ progname, strerror(errno = -rc));
return rc;
}
if (omd->cr_openflags & MDS_FMODE_EXEC) {
mode[2] = 'x';
} else {
- if (omd->cr_openflags & FMODE_READ)
+ if (omd->cr_openflags & MDS_FMODE_READ)
mode[0] = 'r';
if (omd->cr_openflags &
- (FMODE_WRITE |
+ (MDS_FMODE_WRITE |
MDS_OPEN_TRUNC |
MDS_OPEN_APPEND))
mode[1] = 'w';
printf("\n");
llapi_changelog_free(&rec);
- }
+ }
- llapi_changelog_fini(&changelog_priv);
+ llapi_changelog_fini(&changelog_priv);
- if (rc < 0)
- fprintf(stderr, "Changelog: %s\n", strerror(errno = -rc));
+ if (rc < 0)
+ fprintf(stderr, "%s changelog: cannot access changelog: %s\n",
+ progname, strerror(errno = -rc));
- return (rc == 1 ? 0 : rc);
+ return (rc == 1 ? 0 : rc);
}
static int lfs_changelog_clear(int argc, char **argv)