Whamcloud - gitweb
87ad80c6480680cdc1d4dc66a167914df3691523
[fs/lustre-release.git] / lustre / doc / llapi_quotactl.3
1 .TH LLAPI_QUOTACTL 3
2 .SH NAME
3 llapi_quotactl \- manipulate disk quotas on a Lustre filesystem
4 .SH SYNOPSIS
5 .nf
6 .B #include <liblustre.h>
7 .B #include <lustre/lustre_idl.h>
8 .B #include <lustre/liblustreapi.h>
9 .B #include <lustre/lustre_user.h>
10 .sp
11 .BI "int llapi_quotactl(char" " *mnt," " struct if_quotactl" " *qctl)
12 .sp
13 \fBstruct if_quotactl {
14         __u32                   qc_cmd;
15         __u32                   qc_type;
16         __u32                   qc_id;
17         __u32                   qc_stat;
18         struct obd_dqinfo       qc_dqinfo;
19         struct obd_dqblk        qc_dqblk;
20         char                    obd_type[16];
21         struct obd_uuid         obd_uuid;
22 };
23 .sp
24 \fBstruct obd_dqblk {
25         __u64 dqb_bhardlimit;
26         __u64 dqb_bsoftlimit;
27         __u64 dqb_curspace;
28         __u64 dqb_ihardlimit;
29         __u64 dqb_isoftlimit;
30         __u64 dqb_curinodes;
31         __u64 dqb_btime;
32         __u64 dqb_itime;
33         __u32 dqb_valid;
34         __u32 padding;
35 };
36 .sp
37 \fBstruct obd_dqinfo {
38         __u64 dqi_bgrace;
39         __u64 dqi_igrace;
40         __u32 dqi_flags;
41         __u32 dqi_valid;
42 };
43 .sp
44 \fBstruct obd_uuid {
45         char uuid[40];
46 };
47 .fi
48 .SH DESCRIPTION
49 .LP
50 .IX  "filesystem"  "quotactl() disk quotas"  ""  "\fLquotactl()\fP \(em disk quotas"
51 .IX  "quotactl() disk quotas"  ""  "\fLquotactl()\fP \(em disk quotas"
52 .IX  "disk quotas quotactl()"  ""  "disk quotas \(em \fLquotactl()\fP"
53 .LP
54 The
55 .B llapi_quotactl(\|)
56 function manipulates disk quotas on a Lustre filesystem
57 .I mnt.
58 .I qc_cmd
59 indicates a command to be applied to 
60 .SM UID
61 .IR qc_id
62 or 
63 .SM GID
64 .IR qc_id .
65 .TP 15
66 .SB LUSTRE_Q_QUOTAON
67 Turn on quotas for a Lustre filesystem.
68 .I qc_type
69 is USRQUOTA, GRPQUOTA or UGQUOTA (both user and group quotas).
70 The quota files must exist; they are normally created with the
71 .BR llapi_quotacheck (3)
72 call.  This call is restricted to the super-user.
73 .TP
74 .SB LUSTRE_Q_QUOTAOFF
75 Turn off quotas for a Lustre filesystem.
76 .I qc_type
77 is USRQUOTA, GRPQUOTA or UGQUOTA (both user and group quotas).
78 This call is restricted to the super-user.
79 .TP
80 .SB LUSTRE_Q_GETQUOTA
81 Get disk quota limits and current usage for user or group
82 .IR qc_id .
83 .I qc_type
84 is USRQUOTA or GRPQUOTA.
85 .I uuid
86 may be filled with OBD UUID string to query quota information from a specific node.
87 .I dqb_valid
88 may be set nonzero to query information only from MDS. If
89 .I uuid
90 is an empty string and
91 .I dqb_valid
92 is zero then clusterwide limits and usage are returned. On return
93 .I obd_dqblk
94 contains the requested information (block limits unit is kilobyte).
95 Quotas must be turned on before using this command.
96 .TP
97 .SB LUSTRE_Q_SETQUOTA
98 Set disk quota limits for user or group
99 .IR qc_id .
100 .I qc_type
101 is USRQUOTA or GRPQUOTA.
102 .I dqb_valid
103 must be set to QIF_ILIMITS, QIF_BLIMITS or QIF_LIMITS (both inode limits and block limits) dependent on updating limits.
104 .I obd_dqblk
105 must be filled with limits values (as set in
106 .I dqb_valid 
107 , block limits unit is kilobyte).
108 Quotas must be turned on before using this command.
109 .TP
110 .SB LUSTRE_Q_GETINFO
111 Get information about quotas.
112 .I qc_type
113 is either USRQUOTA or GRPQUOTA. On return
114 .I dqi_igrace
115 is inode grace time (in seconds),
116 .I dqi_bgrace
117 is block grace time (in seconds),
118 .I dqi_flags
119 is not used by the current Lustre version.
120 .TP
121 .SB LUSTRE_Q_SETINFO
122 Set quota information (like grace times).
123 .I qc_type
124 is either USRQUOTA or GRPQUOTA.
125 .I dqi_igrace
126 is inode grace time (in seconds),
127 .I dqi_bgrace
128 is block grace time (in seconds),
129 .I dqi_flags
130 is not used by the current Lustre version and must be zeroed.
131 .SH RETURN VALUES
132 .LP
133 .B llapi_quotactl(\|)
134 returns:
135 .TP
136 0
137 on success.
138 .TP
139 \-1
140 on failure and sets
141 .B errno
142 to indicate the error.
143 .SH ERRORS
144 .TP 15
145 .SM EFAULT
146 .I qctl
147 is invalid.
148 .TP
149 .SM ENOSYS
150 The kernel or Lustre modules have not been compiled with the
151 .SB QUOTA
152 option.
153 .TP
154 .SM ENOMEM
155 Insufficient memory to complete operation.
156 .TP
157 .SM ENOTTY
158 .I qc_cmd
159 is invalid.
160 .TP
161 .SM EBUSY
162 Cannot process during quotacheck.
163 .TP
164 .SM ENOENT
165 .I uuid
166 does not correspond to OBD or
167 .I mnt
168 does not exist
169 .TP
170 .SM EPERM
171 The call is privileged and the caller was not the super-user.
172 .TP
173 .SM ESRCH
174 No disc quota is found for the indicated user.
175 .IP
176 Quotas have not been turned on for this filesystem.
177 .SH "SEE ALSO"
178 .BR lfs (1),
179 .BR lustre (7)