-.TH LFS-QUOTA 1 2020-04-06 "Lustre" "Lustre Utilities"
+.TH LFS-QUOTA 1 2022-02-26 "Lustre" "Lustre Utilities"
.SH NAME
lfs-quota \- display quota limits and status for users, groups, or projects.
.SH SYNOPSIS
-.B lfs quota \fR[\fB-hqv\fR]
- [\fB-o <\fIobd_uuid\fR>|\fB-I <\fIost_idx\fR>|\fB-i <\fImdt_idx\fR>]
- [\fB-u <\fIuname\fR|\fIuid\fR>|\fB-g <\fIgname\fR|\fIgid\fR>\
-|\fB-p <\fIprojid\fR>]
- [\fB--pool\fR <\fIpname\fR>]
- <\fIfilesystem\fR>\fR
+.BR "lfs quota " [ -hqv "] [" --ost " \fIobd_uuid\fR|" --mdt " \fIMDT_IDX\fR]
+ [\fB-u \fIUSER\fR|\fB-g <\fIGROUP\fR>|\fB-p \fIPROJID\fR]
+[\fB--pool\fR \fIPOOL_NAME\fR] \fIFILESYSTEM
.br
-.B lfs quota \fR[\fB-hq\fR] \fR<\fB-U\fR|\fB-G\fR|\fB-P\fR> <\fIfilesystem\fR>
+.BR "lfs quota " [ -hq "] {" -U | -G | -P } " " \fIFILESYSTEM
.br
.br
-.B lfs quota -t \fR<\fB-u\fR|\fB-g\fR|\fB-p\fR> <\fIfilesystem\fR>
+.BR "lfs quota " -t " {" -u | -g | -p "} " \fIFILESYSTEM
.br
.br
.TP
.SH DESCRIPTION
.PP
-.B lfs quota <\fIfilesystem\fR>\fR
.TP
-
-Display disk usage and limits for individual users, groups, and projects. \
-An asterisk is displayed when the quota is exceeded. \
-By default the statistics for the entire filesystem are displayed but \
-individual MDTs and OSTs can be specified. \
-A user or group name or an ID can \
-be specified. If user, group and project are omitted, quotas for \
+.B lfs quota \fIFILESYSTEM
+Display disk usage and limits for individual users, groups, and projects.
+An asterisk is displayed when the quota is exceeded.
+By default the statistics for the entire filesystem are displayed but
+individual MDTs and OSTs can be specified with the
+.B --ost
+or
+.B --mdt
+options. A user, group, or project ID can be specified.
+If user, group, and project are omitted, quotas for the
current uid/gid/projid are shown.
.TP
-.B -h
-Human readable. This will change the formatting of \
-block storage and time values. Without this option block storage values \
-are in kilobytes and times are in seconds. With this option block storage \
+.BR -h | --human-readable
+This will change the formatting of
+block storage and time values. Without this option block storage values
+are in kilobytes and times are in seconds. With this option block storage
values use the common metric binary suffixes
-.BR k "," M "," G "," T "," P "," E
-which specify units of 2^10, 2^20, 2^30, 2^40, 2^50 and 2^60 \
-respectively.
-Time values use the "XXwXXdXXhXXmXXs" format. This format specifies \
-weeks, days, hours, minutes, seconds.
-.TP
-.B -q
-Quiet. Display only the line containing the data. \
-The line saying what the data is, and the line with the data
-column headers will not be printed.
-.TP
-.B -v
-Verbose. Display per-MDT and per-OST statistics in addition
-to the usual system wide data. An asterisk near the OST or MDT means that
-the quota is exceeded only for that specific target. The user is over the
-quota only if an asterisk is near the whole filesystem usage.
-Inactive target will also be printed but marked as "inact".
+.BR K ", " M ", " G ", " T ", " P ", and " E
+which specify units of 2^10, 2^20, 2^30, 2^40, 2^50 and 2^60 bytes,
+respectively. Time values will use the "XXwXXdXXhXXmXXs" format, which
+specifies weeks, days, hours, minutes, seconds.
.TP
-.B -u <\fIuname|uid\fR>
-Display user quota information for \fIuname\fR or \fIuid\fR.
+.BR -g | --group " {" \fIGROUP | \fIGID }
+Display quota information for group name \fIGROUP\fR or numeric \fIGID\fR.
.TP
-.B -g <\fIgname|gid\fR>
-Display group quota information for name \fIgname\fR or \fIgid\fR.
+.BR -m | --mdt " " \fIMDT_IDX
+Display quota information for MDT \fIMDT_IDX\fR.
.TP
-.B -p <\fIprojid\fR>
-Display project quota information for \fIprojid\fR.
+.BR -o | --ost " " \fIOST_IDX
+Display quota information for OST \fIOST_IDX\fR.
.TP
-.B -o <\fIobd_uuid\fR>
-Display quota information for \fIobd_uuid\fR.
+.BR --pool " " \fIPOOL_NAME
+Display quota information for OST pool \fIPOOL_NAME\fR.
.TP
-.B -i <\fImdt_idx\fR>
-Display project quota information for \fImdt_idx\fR.
+.BR -p | --projid " " \fIPROJID
+Display quota information for project \fIPROJID\fR.
.TP
-.B -I <\fIost_idx\fR>
-Display project quota information for \fIost_idx\fR.
+.BR -q | --quiet
+Display only the line containing the data.
+The line saying what the data is, and the column headers will not be printed.
.TP
-.B --pool <\fIpname\fR>
-Display quota information per OST pool \fIpname\fR.
+.BR -u | --user " {" \fIUSER | \fIUID }
+Display quota information for user name \fIUSER\fR or numeric \fIUID\fR.
.TP
-.B lfs quota \fR<\fB-U\fR|\fB-G\fR|\fB-P\fR> <\fIfilesystem\fR>
+.BR -v | --verbose
+Display per-MDT and per-OST statistics in addition
+to the usual system wide data. An asterisk near the OST or MDT means that
+the quota is exceeded only for that specific target. The user is over the
+quota only if an asterisk is near the whole filesystem usage.
+Inactive target will also be printed but marked as "inact".
.TP
-Display default quota values for users, groups, or projects. \
+.BR "lfs quota " { -U | -G | -P "} " FILESYSTEM
+Display default quota values for users, groups, or projects.
This command requires super user permissions.
.TP
-.B -U <\fIuname|uid\fR>
-Display default user quota information for <\fIfilesystem\fR>.
-.TP
-.B -G <\fIgname|gid\fR>
-Display default group quota information for name <\fIfilesystem\fR>.
-.TP
-.B -P <\fIprojid\fR>
-Display default project quota information for <\fIfilesystem\fR>.
-.TP
-.B lfs quota -t \fR<\fB-u\fR|\fB-g\fR|\fB-p\fR> [\fB--pool\fR <\fIpname\fR>] <\fIfilesystem\fR>
+.BR -G | --default-grp " {" \fIGROUP | \fIGID }
+Display default quota limits for group name \fIGROUP\fR or numeric \fIGID\fR.
.TP
-Display grace times for users, groups, or projects. \
-The format is always "XXwXXdXXhXXmXXs".
+.BR -P \fIPROJID
+Display default quota limits for project \fIPROJID\fR.
.TP
-.B -u <\fIuname|uid\fR>
-Display default user grace times for <\fIfilesystem\fR>.
+.BR -U | --default-usr " {" \fIUSER | UID }
+Display default quota limits for username \fIUSER\fR or numeric \fIUID\fR.
.TP
-.B -g <\fIgname|gid\fR>
-Display default group grace times for name <\fIfilesystem\fR>.
-.TP
-.B -p <\fIprojid\fR>
-Display default project grace times for <\fIfilesystem\fR>.
-.TP
-.B --pool <\fIpname\fR>
-Display user, group or project grace times per OST pool \fIpname\fR.
-.TP
-.B lfs quota -a \fR<\fB-u\fR|\fB-g\fR|\fB-p\fR> <\fIfilesystem\fR>
+.BR "lfs quota -a" " {" -u | -g | -p "} " \fIFILESYSTEM
.TP
Display all quota setting for all users, groups, or projects.
.TP
+.BR "lfs quota -t" | --times " {" -u | -g | -p "} [" --pool " \fIPOOL_NAME\fR] " \fIFILESYSTEM
+Display grace times for users, groups, or projects.
+Time values use the "XXwXXdXXhXXmXXs" format, which specifies
+weeks, days, hours, minutes, seconds.
.SH EXAMPLES
.TP
.B $ lfs quota /mnt/lustre
Display quotas and usage for current user, group, and project
.TP
-.B $ lfs quota -u bob /mnt/lustre
+.B # lfs quota -u bob /mnt/lustre
Display quotas and usage for user 'bob'
.TP
-.B $ lfs quota -U /mnt/lustre
+.B # lfs quota -U /mnt/lustre
Display default user quotas
.TP
.B $ lfs quota -t -u /mnt/lustre
Display grace times for user quotas on /mnt/lustre
.TP
-.B $ lfs quota -u ivan --pool flash_pool /mnt/lustre
-Display quotas and usage for user 'ivan' per 'flash_pool"
+.B # lfs quota -u ivan --pool flash_pool /mnt/lustre
+Display quotas and usage for user
+.B ivan
+from the OST pool
+.BR flash_pool .
.TP
.B $ lfs quota -t -g --pool flash_pool /mnt/lustre
-Display grace times for group quotas per 'flash_pool"
+Display grace times for group quotas for the OST pool
+.BR flash_pool .
.TP
.SH SEE ALSO
.BR lfs (1),
-.TH LFS-SETQUOTA 1 2017-07-21 "Lustre" "Lustre Utilities"
+.TH LFS-SETQUOTA 1 2022-02-26 "Lustre" "Lustre Utilities"
.SH NAME
lfs-setquota \- set quota limits or grace time for users, groups or projects.
.SH SYNOPSIS
-.BR "lfs setquota " { -u | --user | -g | --group | -p | --projid "} " \fIUID | \fIGID | \fIPROJID
- [\fB--pool \fIPOOLNAME ]
- [\fB--block-softlimit\fR|\fB-b \fIBLOCK_SOFTLIMIT\fR[\fBkMGTPE\fR]]
- [\fB--block-hardlimit\fR|\fB-B \fIBLOCK_HARDLIMIT\fR[\fBkMGTPE\fR]]
- [\fB--inode-softlimit\fR|\fB-i \fIINODE_SOFTLIMIT\fR[\fBkMGTPE\fR]]
- [\fB--inode-hardlimit\fR|\fB-I \fIINODE_HARDLIMIT\fR[\fBkMGTPE\fR]] <\fIfilesystem\fR>
-.TP
-.BR "lfs setquota -t " { -h | -u | -g | -p }
- [\fB--pool\fR \fIPOOL_NAME\fR]
- [\fB--block-grace\fR|\fB-b\fR \fIBLOCK_GRACE_TIME\fR]
- [\fB--inode-grace\fR|\fB-i\fR \fIINODE_GRACE_TIME\fR] <\fIfilesystem\fR>
+.BR "lfs setquota " { -u | --user | -g | --group | -p | --projid "} " \fIID
+[\fB--pool \fIPOOLNAME\fR]
+ [\fB-b|\fB--block-softlimit\fR \fIBLOCK_SOFTLIMIT\fR[\fBKMGTPE\fR]]
+ [\fB-B|\fB--block-hardlimit\fR \fIBLOCK_HARDLIMIT\fR[\fBKMGTPE\fR]]
+ [\fB-i|\fB--inode-softlimit\fR \fIINODE_SOFTLIMIT\fR[\fBKMGTPE\fR]]
+ [\fB-I|\fB--inode-hardlimit\fR \fIINODE_HARDLIMIT\fR[\fBKMGTPE\fR]] \fIFILESYSTEM
.TP
-.BR "lfs setquota " { -u | --user | -g | --group | -p | --projid "} " \fIUID\fR|\fIGID\fR|\fIPROJID\fR
- [\fB--default|-D\fR] <\fIfilesystem\fR>
+.BR "lfs setquota " { -u | --user | -g | --group | -p | --projid "} " \fIID
+ {\fB--default\fR|\fB-D\fR|\fB--delete\fR} \fIFILESYSTEM
+.TP
+.BR "lfs setquota " { -t | --times "} {" -h | -u | -g | -p "} [" "--pool " \fIPOOLNAME ]
+ [\fB-b\fR|\fB--block-grace\fR \fIBLOCK_GRACE_TIME\fR]
+ [\fB-i\fR|\fB--inode-grace\fR \fIINODE_GRACE_TIME\fR] \fIFILESYSTEM
.TP
.BR "lfs setquota " { -U | --default-usr | -G | --default-grp | -P | --default-prj }
- [\fB--block-softlimit\fR|\fB-b\fR \fIBLOCK_SOFTLIMIT\fR[\fBkMGTPE\fR]]
- [\fB--block-hardlimit\fR|\fB-B\fR \fIBLOCK_HARDLIMIT\fR[\fBkMGTPE\fR]]
- [\fB--inode-softlimit\fR|\fB-i\fR \fIINODE_SOFTLIMIT\fR[\fBkMGTPE\fR]]
- [\fB--inode-hardlimit\fR|\fB-I\fR \fIINODE_HARDLIMIT\fR[\fBkMGTPE\fR]] <\fIfilesystem\fR>
+ [\fB-b\fR|\fB--block-softlimit\fR \fIBLOCK_SOFTLIMIT\fR[\fBKMGTPE\fR]]
+ [\fB-B\fR|\fB--block-hardlimit\fR \fIBLOCK_HARDLIMIT\fR[\fBKMGTPE\fR]]
+ [\fB-i\fR|\fB--inode-softlimit\fR \fIINODE_SOFTLIMIT\fR[\fBKMGTPE\fR]]
+ [\fB-I\fR|\fB--inode-hardlimit\fR \fIINODE_HARDLIMIT\fR[\fBKMGTPE\fR]] \fIFILESYSTEM
.TP
.BR "lfs setquota " { -u | --user | -g | --group | -p | --projid "} " \fIUID\fR|\fIGID\fR|\fIPROJID\fR
[\fB--delete\fR] <\fIfilesystem\fR>
.TP
.SH DESCRIPTION
.TP
-.BR "lfs setquota " {\fB-u|-g|-p\fR}
-Command sets the filesystem quotas for users, groups or projects respectively.
-Block limits unit is kilobyte (1024) by default and block limits are always
-kilobyte-grained (even if specified in bytes), block limits can be specified
+.BR "lfs setquota " { -u | -g | -p }
+Command sets the filesystem quotas for users, groups, or projects respectively.
+Block limits unit is kilobyte (1024) by default, and block limits are always
+kilobyte-granular (even if specified in bytes), block limits can be specified
with a
-.BR k "," M "," G "," T "," P ", or " E
-suffixes which specify units of 2^10, 2^20, 2^30, 2^40, 2^50 and 2^60
-accordingly.
+.BR K ", " M ", " G ", " T ", " P ", or " E
+suffix to specify units of 2^10, 2^20, 2^30, 2^40, 2^50 and 2^60 bytes
+respectively.
.TP
-.BR -b | --block-softlimit \fIBLOCK_SOFTLIMIT
+.BR -b | --block-softlimit " " \fIBLOCK_SOFTLIMIT
Specify block softlimit, zero means unlimited.
.TP
-.BR -B | --block-hardlimit \fIBLOCK_HARDLIMIT
+.BR -B | --block-hardlimit " " \fIBLOCK_HARDLIMIT
Specify block hardlimit, zero means unlimited. The block hardlimit should be
-greater than block softlimit when it's being specified.
+greater than the block softlimit if it is being specified.
.TP
.BR --delete
-Delete the unused UID|GID|PROJID.
+Delete the unused user, group, or project \fIID\fR limit.
.TP
.BR -D|--default
Set user/group/project to use the default quota limits.
.TP
-.BR -g | --group \fIGROUPNAME\fR|\fIGID
-Set group quota for name \fIGROUPNAME\fR or \fIGID\fR.
+.BR -g | --group " " \fIGROUPNAME | \fIGID
+Set group quota for name \fIGROUPNAME\fR or numeric \fIGID\fR.
.TP
.BR -h | --help
Print usage message.
.TP
-.BR -i | --inode-softlimit \fIINODE_SOFTLIMIT
+.BR -i | --inode-softlimit " " \fIINODE_SOFTLIMIT
Specify inode softlimit, zero means unlimited.
.TP
-.B -I|--inode-hardlimit \fIINODE_HARDLIMIT\fR
+.BR -I | --inode-hardlimit " " \fIINODE_HARDLIMIT
Specify inode hardlimit, zero means unlimited. The inode hardlimit should be
greater than inode softlimit when it's being specified.
.TP
-.B -p|--project \fIPROJID\fR
-Set project quota for \fIPROJID\fR.
+.BR -p | --project " " \fIPROJID
+Set project quota for numeric \fIPROJID\fR.
.TP
-.B --pool \fIPOOL_NAME\fR
+.BR --pool " " \fIPOOL_NAME
Set quota per OST pool \fIPOOL_NAME\fR.
.TP
.BR -r
Reset the internal quota data of the user|group|project quota. It can be used
to fix the quota containing corrupted internal data (such as, the quota grant).
.TP
-.BR -u | --user \fIUSERNAME\fR|\fBUID
-Set user quota for \fIUNAME\fR or \fIUID\fR.
+.BR -u | --user " " \fIUSERNAME | \fIUID
+Set user quota for \fIUNAME\fR or numeric \fIUID\fR.
.PP
.TP
-.BR "lfs setquota -t " { -h | -u | -g | -p "} " \fIGRACE_TIME
+.BR "lfs setquota " { -t | --times "} {" -h | -u | -g | -p "} " \fIGRACE_TIME
Command sets the filesystem quota grace time for users, groups, or projects.
The
.I GRACE_TIME
is a global value that can take two forms: an amount of time or the word
.BR notify .
-Traditionally, this indicates the amount of time in seconds
+Traditionally,
+.I GRACE_TIME indicates the amount of time in seconds
that the soft quota limit can be exceeded before users are prevented from
creating new files or consuming more space. This is intended to allow users
to exceed the quota limit for a short time to complete their work without
-having to grant each user a larger hard quota limit. The alternative value of
+having to grant each user a larger hard quota limit.
+.PP
+The alternative value of
.B notify
-informs users with an '\fB*\fR' in the quota output that they
-are nearing their hard quota limit but does not block new writes until the hard
+informs users that are exceeding their soft quota limit (an '\fB*\fR' in the
+quota output) that they
+are nearing their hard quota limit, but does not block new writes until the hard
quota limit is reached. The soft quota state is reset once the user, group,
or project reduces their space usage or file count below the soft quota limit.
Grace time is specified in "XXwXXdXXhXXmXXs" format or as an integer seconds
value. The maximum is 2^48 - 1 seconds.
.TP
-.B -t
+.BR -t | --times
Set quota grace times.
.TP
-.B -u
+.BR -u | --user
Set grace time for user.
.TP
-.B -g
+.BR -g | --group
Set grace time for group.
.TP
-.B -p
+.BR -p | --projid
Set grace time for project.
.TP
-.BR -b | "--block-grace notify" | \fIBLOCK_GRACE_TIME\fR
-Specify grace time for block quota.
+.BR -b | --block-grace " {" notify | \fIBLOCK_GRACE_TIME }
+Specify grace time for block quota in seconds.
.TP
-.BR -i | "--inode-grace notify" | \fIINODE_GRACE_TIME\fR
-Specify grace time for inode quota.
+.BR -i | --inode-grace " {" notify | \fIBLOCK_GRACE_TIME }
+Specify grace time for inode quota in seconds.
.TP
-.B --pool \fIPOOL_NAME\fR
+.BR --pool " " \fIPOOL_NAME
Set grace time for user, group or project per OST pool \fIPOOL_NAME\fR.
+.PP
.TP
.BR "lfs setquota " { -U | --default-usr | -G | --default-grp | -P | --default-prj }
Command sets the filesystem default limits for user, group, project quotas,
.TP
.BR -G | --default-grp
Set default group quota limit.
-.TP
+.T
.BR -P | --default-prj
Set default project quota limit.
.TP
.B $ lfs setquota -u bob --block-softlimit 2G --block-hardlimit 1G /mnt/lustre
Set quotas of user `bob': 1GB block hardlimit and 2 GB block softlimit
.TP
-.B $ lfs setquota -u bob -D /mnt/lustre
+.B $ lfs setquota -u bob --default /mnt/lustre
Set quotas of user `bob' to use default quota setting
.TP
.B $ lfs setquota -U --block-softlimit 1G --block-hardlimit 2G /mnt/lustre
Set system default user quota: 1 GB block softlimit and 2 GB block hardlimit
.TP
-.B $ lfs setquota -t -u --block-grace 1000 --inode-grace 1w4d /mnt/lustre
-Set grace times for user quotas: 1000 seconds for block quotas, 1 week and 4
+.B $ lfs setquota -t -u --block-grace 36000 --inode-grace 1w4d /mnt/lustre
+Set grace times for user quotas: 36000 seconds for block quotas, 1 week and 4
days for inode quotas
.TP
.B $ lfs setquota -u ivan --pool flash_pool -B 1G /mnt/lustre
Set hard block limit 1G for user 'ivan' per pool 'flash_pool'
.TP
-.B $ lfs setquota -t -u --block-grace 1000 --pool flash_pool /mnt/lustre
-Set grace time 1000 seconds for block quotas per pool 'flash_pool'
+.B $ lfs setquota -t -u --block-grace 10000 --pool flash_pool /mnt/lustre
+Set grace time 10000 seconds for block quotas per pool 'flash_pool'
.TP
.BR "lfs setquota " { -u | -g | -p "} " \fIUID\fR|\fIGID\fR|\fIPROJID\fR " " [\fB--delete\fR] " " <\fIfilesystem\fR>
-Command deletes the unused UID|GID|PROJID from Quota settings.
+Command deletes the unused user, group, or project \fIID\fR from quota settings.
.TP
.PP
.SH EXAMPLES
"Usage: getname [--help|-h] [--instance|-i] [--fsname|-n] [path ...]"},
#ifdef HAVE_SYS_QUOTA_H
{"setquota", lfs_setquota, 0, "Set filesystem quotas.\n"
- "usage: setquota [-t][-D] {-u|-U|-g|-G|-p|-P} {-b|-B|-i|-I LIMIT} [--pool POOL] FILESYSTEM\n"
- " setquota {-u|-g|-p} --delete FILESYSTEM\n"},
+ "usage: setquota [-t] {-u|-U|-g|-G|-p|-P ID} {-b|-B|-i|-I LIMIT} [--pool POOL] FILESYSTEM\n"
+ " setquota {-u|-g|-p ID} {--default|--delete} FILESYSTEM\n"},
{"quota", lfs_quota, 0, "Display disk usage and limits.\n"
"usage: quota [-q] [-v] [-h] [-o OBD_UUID|-i MDT_IDX|-I OST_IDX]\n"
" [{-u|-g|-p} UNAME|UID|GNAME|GID|PROJID]\n"
- " [--pool <OST pool name>] <filesystem>\n"
- " quota -t <-u|-g|-p> [--pool <OST pool name>] <filesystem>\n"
- " quota [-q] [-v] [h] {-U|-G|-P} [--pool <OST pool name>] <filesystem>\n"
- " quota -a {-u|-g|-p} [-s start_qid] [-e end_qid] <filesystem>"},
+ " [--pool OST_POOL_NAME] FILESYSTEM\n"
+ " quota -t {-u|-g|-p} [--pool OST_POOL_NAME] FILESYSTEM\n"
+ " quota [-hqv] {-U|-G|-P} [--pool OST_POOL_NAME] FILESYSTEM\n"
+ " quota -a {-u|-g|-p} [-s START_QID] [-e END_QID] FILESYSTEM"},
{"project", lfs_project, 0,
"Change or list project attribute for specified file or directory.\n"
"usage: project [-d|-r] <file|directory...>\n"
int i;
for (i = 1; i < argc; i++)
- if (!strcmp(argv[i], "-t"))
+ if (!strcmp(argv[i], "-t") || !strcmp(argv[i], "--times"))
return 1;
return 0;
{ .val = 'g', .name = "group", .has_arg = no_argument },
{ .val = 'h', .name = "help", .has_arg = no_argument },
{ .val = 'i', .name = "inode-grace", .has_arg = required_argument },
+ { .val = LFS_POOL_OPT, .name = "pool", .has_arg = required_argument },
{ .val = 'p', .name = "projid", .has_arg = no_argument },
{ .val = 't', .name = "times", .has_arg = no_argument },
{ .val = 'u', .name = "user", .has_arg = no_argument },
- { .val = LFS_POOL_OPT,
- .name = "pool", .has_arg = required_argument },
{ .name = NULL } };
int qtype;
while ((c = getopt_long(argc, argv, "b:ghi:ptu",
long_opts, NULL)) != -1) {
switch (c) {
- case 'u':
- qtype = USRQUOTA;
- goto quota_type;
- case 'g':
- qtype = GRPQUOTA;
- goto quota_type;
- case 'p':
- qtype = PRJQUOTA;
-quota_type:
- if (qctl->qc_type != ALLQUOTA) {
- fprintf(stderr,
- "%s: -u/g/p cannot be used more than once\n",
- progname);
- return CMD_HELP;
- }
- qctl->qc_type = qtype;
- break;
case 'b':
if (strncmp(optarg, NOTIFY_GRACE,
strlen(NOTIFY_GRACE)) == 0) {
}
dqb->dqb_valid |= QIF_BTIME;
break;
+ case 'g':
+ qtype = GRPQUOTA;
+ goto quota_type;
case 'i':
if (strncmp(optarg, NOTIFY_GRACE,
strlen(NOTIFY_GRACE)) == 0) {
}
dqb->dqb_valid |= QIF_ITIME;
break;
- case 't': /* Yes, of course! */
- break;
+ case 'p':
+ qtype = PRJQUOTA;
+ goto quota_type;
case LFS_POOL_OPT:
if (lfs_verify_poolarg(optarg))
return -1;
strncpy(qctl->qc_poolname, optarg, LOV_MAXPOOLNAME);
qctl->qc_cmd = LUSTRE_Q_SETINFOPOOL;
break;
+ case 't': /* Yes, of course! */
+ break;
+ case 'u':
+ qtype = USRQUOTA;
+quota_type:
+ if (qctl->qc_type != ALLQUOTA) {
+ fprintf(stderr,
+ "%s: -u/g/p cannot be used more than once\n",
+ progname);
+ return CMD_HELP;
+ }
+ qctl->qc_type = qtype;
+ break;
/* getopt prints error message for us when opterr != 0 */
default:
fprintf(stderr, "%s: unrecognized option '%s'\n",
}
qctl->qc_type = qtype;
break;
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0)
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 22, 53, 0)
case 'd':
fprintf(stderr,
"%s setquota: '-d' deprecated, use '-D' or '--default'\n",
dash += 4;
*idx = strtoul(dash, &endp, 16);
- if (*idx > 0xffff) {
+ if (*idx > LOV_V1_INSANE_STRIPE_COUNT) {
fprintf(stderr, "wrong index %s\n", tgtname);
return -ERANGE;
}
int c;
char *mnt, *name = NULL;
struct if_quotactl *qctl;
- char *obd_uuid;
+ char *obd_uuid, *endp;
int rc = 0, rc1 = 0, verbose = 0, quiet = 0;
- __u32 valid = QC_GENERAL, idx = 0;
+ __u32 valid = QC_GENERAL;
+ long idx = 0;
__u32 start_qid = 0, end_qid = 0;
bool human_readable = false;
bool show_default = false;
int qtype;
bool show_pools = false;
struct option long_opts[] = {
- { .val = LFS_POOL_OPT, .name = "pool", .has_arg = optional_argument },
+ { .val = 'a', .name = "all", .has_arg = required_argument },
+ { .val = 'e', .name = "end-qid", .has_arg = required_argument },
+ { .val = 'g', .name = "group", .has_arg = required_argument },
+ { .val = 'G', .name = "default-grp", .has_arg = no_argument },
+ { .val = 'h', .name = "human-readable", .has_arg = no_argument },
+ /* It is unfortunate that '-i' was used for mdt-index, and '-I' for
+ * ost-index, because '-i' is used for ost-index everywhere else.
+ * These options have been this way since ancient days, but I suspect
+ * that they are not often used. Prefer --ost and --mdt instead.
+ */
+ { .val = 'm', .name = "mdt-index", .has_arg = required_argument },
+ { .val = 'm', .name = "mdt", .has_arg = required_argument },
+ { .val = 'o', .name = "ost-index", .has_arg = required_argument },
+ { .val = 'o', .name = "ost", .has_arg = required_argument },
+ { .val = LFS_POOL_OPT, .name = "pool", .has_arg = optional_argument },
+ { .val = 'p', .name = "projid", .has_arg = required_argument },
+ { .val = 'P', .name = "default-prj", .has_arg = no_argument },
+ { .val = 'q', .name = "quiet", .has_arg = no_argument },
+ { .val = 's', .name = "start-qid", .has_arg = required_argument },
+ { .val = 't', .name = "times", .has_arg = no_argument },
+ { .val = 'u', .name = "user", .has_arg = required_argument },
+ { .val = 'U', .name = "default-usr", .has_arg = required_argument },
+ { .val = 'v', .name = "verbose", .has_arg = no_argument },
{ .name = NULL } };
char **poollist = NULL;
char *buf = NULL;
qctl->qc_type = ALLQUOTA;
obd_uuid = (char *)qctl->obd_uuid.uuid;
- while ((c = getopt_long(argc, argv, "ae:gGi:I:o:pPqs:tuUvh",
+ while ((c = getopt_long(argc, argv, "ae:gGhi:I:m:o:pPqs:tuUv",
long_opts, NULL)) != -1) {
switch (c) {
- case 'U':
- show_default = true;
- case 'u':
- qtype = USRQUOTA;
- goto quota_type;
+ case 'a':
+ qctl->qc_cmd = LUSTRE_Q_ITERQUOTA;
+ break;
+ case 'e':
+ end_qid = strtoul(optarg, NULL, 0);
+ break;
case 'G':
show_default = true;
+ /* fallthrough */
case 'g':
qtype = GRPQUOTA;
goto quota_type;
- case 'P':
- show_default = true;
- case 'p':
- qtype = PRJQUOTA;
-quota_type:
- if (qctl->qc_type != ALLQUOTA) {
- fprintf(stderr,
- "%s quota: only one of -u, -g, or -p may be specified\n",
- progname);
- rc = CMD_HELP;
- goto out;
- }
- qctl->qc_type = qtype;
- break;
- case 'a':
- qctl->qc_cmd = LUSTRE_Q_ITERQUOTA;
- break;
- case 't':
- qctl->qc_cmd = LUSTRE_Q_GETINFO;
- break;
- case 'o':
- valid = qctl->qc_valid = QC_UUID;
- snprintf(obd_uuid, sizeof(*obd_uuid), "%s", optarg);
+ case 'h':
+ human_readable = true;
break;
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 22, 53, 0)
case 'i':
- valid = qctl->qc_valid = QC_MDTIDX;
- idx = qctl->qc_idx = atoi(optarg);
- if (idx == 0 && *optarg != '0') {
+ fprintf(stderr,
+ "'-i' deprecated, use '--ost' or '--mdt'\n");
+ /* fallthrough */
+#endif
+ case 'm':
+ errno = 0;
+ idx = strtol(optarg, &endp, 0);
+ if (errno != 0 || idx > LOV_V1_INSANE_STRIPE_COUNT ||
+ idx < 0 || *endp != '\0') {
fprintf(stderr,
"%s quota: invalid MDT index '%s'\n",
progname, optarg);
rc = CMD_HELP;
goto out;
}
+ valid = qctl->qc_valid = QC_MDTIDX;
+ qctl->qc_idx = idx;
break;
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 22, 53, 0)
case 'I':
- valid = qctl->qc_valid = QC_OSTIDX;
- idx = qctl->qc_idx = atoi(optarg);
- if (idx == 0 && *optarg != '0') {
- fprintf(stderr,
- "%s quota: invalid OST index '%s'\n",
- progname, optarg);
- rc = CMD_HELP;
- goto out;
+ fprintf(stderr, "'-I' deprecated, use '--ost'\n");
+ /* fallthrough */
+#endif
+ case 'o':
+ errno = 0;
+ idx = strtol(optarg, &endp, 0);
+ /* simple digit, treat it as a numerical OST index */
+ if (*endp == '\0') {
+ if (idx > LOV_V1_INSANE_STRIPE_COUNT ||
+ idx < 0) {
+ fprintf(stderr,
+ "%s quota: invalid OST index '%s'\n",
+ progname, optarg);
+ rc = CMD_HELP;
+ goto out;
+ }
+ valid = qctl->qc_valid = QC_OSTIDX;
+ qctl->qc_idx = idx;
+ break;
}
+
+ /* need to also handle a UUID for compatibility */
+ valid = qctl->qc_valid = QC_UUID;
+ snprintf(obd_uuid, sizeof(*obd_uuid), "%s", optarg);
break;
- case 's':
- start_qid = strtoul(optarg, NULL, 0);
- break;
- case 'e':
- end_qid = strtoul(optarg, NULL, 0);
- break;
- case 'v':
- verbose = 1;
- break;
- case 'q':
- quiet = 1;
- break;
- case 'h':
- human_readable = true;
- break;
+ case 'P':
+ show_default = true;
+ /* fallthrough */
+ case 'p':
+ qtype = PRJQUOTA;
+ goto quota_type;
case LFS_POOL_OPT:
if ((!optarg) && (argv[optind] != NULL) &&
(argv[optind][0] != '-') &&
show_pools = true;
qctl->qc_cmd = LUSTRE_Q_GETQUOTAPOOL;
break;
+ case 'q':
+ quiet = 1;
+ break;
+ case 's':
+ start_qid = strtoul(optarg, NULL, 0);
+ break;
+ case 't':
+ qctl->qc_cmd = LUSTRE_Q_GETINFO;
+ break;
+ case 'U':
+ show_default = true;
+ /* fallthrough */
+ case 'u':
+ qtype = USRQUOTA;
+quota_type:
+ if (qctl->qc_type != ALLQUOTA) {
+ fprintf(stderr,
+ "%s quota: only one of -u, -g, or -p may be specified\n",
+ progname);
+ rc = CMD_HELP;
+ goto out;
+ }
+ qctl->qc_type = qtype;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
default:
fprintf(stderr, "%s quota: unrecognized option '%s'\n",
progname, argv[optind - 1]);