"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"
"usage: getstripe [--obd|-O <uuid>] [--quiet | -q] [--verbose | -v]\n"
+ " [--count | -c ] [--size | -s ] [--index | -i ]\n"
+ " [--offset | -o ] [--pool | -p ]\n"
" [--recursive | -r] <dir|file> ..."},
{"pool_list", lfs_poollist, 0,
"List pools or pool OSTs\n"
{"obd", 1, 0, 'O'},
{"quiet", 0, 0, 'q'},
{"recursive", 0, 0, 'r'},
+ {"count", 0, 0, 'c'},
+ {"size", 0, 0, 's'},
+ {"index", 0, 0, 'i'},
+ {"offset", 0, 0, 'o'},
+ {"pool", 0, 0, 'p'},
{"verbose", 0, 0, 'v'},
{0, 0, 0, 0}
};
- char short_opts[] = "hO:qrv";
+ char short_opts[] = "hO:qrvcsiop";
int c, rc;
struct find_param param = { 0 };
break;
case 'q':
param.quiet++;
- param.verbose = 0;
break;
case 'r':
param.recursive = 1;
break;
case 'v':
- param.verbose++;
+ param.verbose = VERBOSE_ALL | VERBOSE_DETAIL;
param.quiet = 0;
break;
+ case 'c':
+ param.verbose |= VERBOSE_COUNT;
+ break;
+ case 's':
+ param.verbose |= VERBOSE_SIZE;
+ break;
+ case 'i':
+ case 'o':
+ param.verbose |= VERBOSE_OFFSET;
+ break;
+ case 'p':
+ param.verbose |= VERBOSE_POOL;
+ break;
case '?':
return CMD_HELP;
default:
mnt = argv[optind];
- memset(&qctl, 0, sizeof(qctl));
- qctl.qc_cmd = LUSTRE_Q_QUOTAOFF;
- qctl.qc_type = check_type;
- rc = llapi_quotactl(mnt, &qctl);
- if (rc) {
- fprintf(stderr, "quota off failed: %s\n", strerror(errno));
- return rc;
- }
-
rc = llapi_quotacheck(mnt, check_type);
if (rc) {
fprintf(stderr, "quotacheck failed: %s\n", strerror(errno));
qctl.qc_cmd = LUSTRE_Q_QUOTAON;
qctl.qc_type = check_type;
rc = llapi_quotactl(mnt, &qctl);
- if (rc) {
+ if (rc && errno != EALREADY) {
if (*obd_type)
fprintf(stderr, "%s %s ", (char *)qctl.obd_type,
obd_uuid2str(&qctl.obd_uuid));
rc = llapi_quotactl(mnt, &qctl);
if (rc) {
- if (*obd_type)
- fprintf(stderr, "%s %s ", obd_type,
- obd_uuid2str(&qctl.obd_uuid));
- fprintf(stderr, "%s failed: %s\n", argv[0], strerror(errno));
- return rc;
+ if (errno == EALREADY) {
+ fprintf(stderr, "\n%s quotas are enabled already.\n",
+ qctl.qc_type == 0x02 ? "user/group" :
+ (qctl.qc_type == 0x00 ? "user" : "group"));
+ rc = 0;
+ } else {
+ if (*obd_type)
+ fprintf(stderr, "%s %s ", obd_type,
+ obd_uuid2str(&qctl.obd_uuid));
+ fprintf(stderr, "%s failed: %s\n", argv[0],
+ strerror(errno));
+ }
}
- return 0;
+ return rc;
}
static int lfs_quotaoff(int argc, char **argv)
mnt = argv[optind];
rc = llapi_quotactl(mnt, &qctl);
- if (rc == -1 && errno == ESRCH) {
- fprintf(stderr, "\n%s quotas are not enabled.\n",
- qctl.qc_type == 0x00 ? "user" : "group");
- return 0;
- }
if (rc) {
- if (*obd_type)
- fprintf(stderr, "%s %s ", obd_type,
- obd_uuid2str(&qctl.obd_uuid));
- fprintf(stderr, "quotaoff failed: %s\n", strerror(errno));
- return rc;
+ if (errno == EALREADY) {
+ fprintf(stderr, "\n%s quotas are disabled already.\n",
+ qctl.qc_type == 0x02 ? "user/group" :
+ (qctl.qc_type == 0x00 ? "user" : "group"));
+ rc = 0;
+ } else {
+ if (*obd_type)
+ fprintf(stderr, "%s %s ", obd_type,
+ obd_uuid2str(&qctl.obd_uuid));
+ fprintf(stderr, "quotaoff failed: %s\n",
+ strerror(errno));
+ }
}
- return 0;
+ return rc;
}
static int lfs_quotainv(int argc, char **argv)
mnt = argv[optind];
rc1 = llapi_quotactl(mnt, &qctl);
- if (rc1 == -1 && errno == ESRCH) {
+ if (rc1 == -1 && errno == EALREADY) {
fprintf(stderr, "\n%s quotas are not enabled.\n",
qctl.qc_type == USRQUOTA ? "user" : "group");
goto out;
static int lfs_path2fid(int argc, char **argv)
{
char *path;
- unsigned long long seq;
- unsigned long oid, ver;
+ lustre_fid fid;
int rc;
if (argc != 2)
return CMD_HELP;
path = argv[1];
- rc = llapi_path2fid(path, &seq, &oid, &ver);
+ rc = llapi_path2fid(path, &fid);
if (rc) {
fprintf(stderr, "can't get fid for %s: %s\n", path,
strerror(errno = -rc));
return rc;
}
- printf(DFID"\n", seq, (unsigned int)oid, (unsigned int)ver);
+ printf(DFID"\n", PFID(&fid));
return 0;
}
}
obd_finalize(argc, argv);
- return rc;
+ return rc < 0 ? -rc : rc;
}