Whamcloud - gitweb
dc15a787b9a5b774c1329422919fd5be8218ae7d
[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.
73
74 This call is restricted to the super-user.
75 .TP
76 .SB LUSTRE_Q_QUOTAOFF
77 Turn off quotas for a Lustre filesystem.
78 .I qc_type
79 is USRQUOTA, GRPQUOTA or UGQUOTA (both user and group quotas).
80
81 This call is restricted to the super-user.
82 .TP
83 .SB LUSTRE_Q_GETQUOTA
84 Get disk quota limits and current usage for user or group
85 .IR qc_id .
86 .I qc_type
87 is USRQUOTA or GRPQUOTA.
88 .I uuid
89 may be filled with OBD UUID string to query quota information from a specific node.
90 .I dqb_valid
91 may be set nonzero to query information only from MDS. If
92 .I uuid
93 is an empty string and
94 .I dqb_valid
95 is zero then clusterwide limits and usage are returned. On return
96 .I obd_dqblk
97 contains the requested information (block limits unit is kilobyte).
98 .I dqb_btime
99 and
100 .I dqb_itime
101 are block and inode softlimit grace period expiration timestamps for the requested user or group.
102
103 Quotas must be turned on before using this command.
104 .TP
105 .SB LUSTRE_Q_SETQUOTA
106 Set disk quota limits for user or group
107 .IR qc_id .
108 .I qc_type
109 is USRQUOTA or GRPQUOTA.
110 .I dqb_valid
111 must be set to QIF_ILIMITS, QIF_BLIMITS or QIF_LIMITS (both inode limits and block limits) dependent on updating limits.
112 .I obd_dqblk
113 must be filled with limits values (as set in
114 .I dqb_valid 
115 , block limits unit is kilobyte).
116
117 Quotas must be turned on before using this command.
118 .TP
119 .SB LUSTRE_Q_GETINFO
120 Get information about quotas.
121 .I qc_type
122 is either USRQUOTA or GRPQUOTA. On return
123 .I dqi_igrace
124 is the default inode grace period duration for all users or all groups (in seconds),
125 .I dqi_bgrace
126 is the default block grace period duration for all users or all groups (in seconds),
127 .I dqi_flags
128 is not used by the current Lustre version.
129 .TP
130 .SB LUSTRE_Q_SETINFO
131 Set quota information (like grace times).
132 .I qc_type
133 is either USRQUOTA or GRPQUOTA.
134 .I dqi_igrace
135 is inode grace time (in seconds),
136 .I dqi_bgrace
137 is block grace time (in seconds),
138 .I dqi_flags
139 is not used by the current Lustre version and must be zeroed.
140 .SH RETURN VALUES
141 .LP
142 .B llapi_quotactl(\|)
143 returns:
144 .TP
145 0
146 on success.
147 .TP
148 \-1
149 on failure and sets
150 .B errno
151 to indicate the error.
152 .SH ERRORS
153 .TP 15
154 .SM EFAULT
155 .I qctl
156 is invalid.
157 .TP
158 .SM ENOSYS
159 The kernel or Lustre modules have not been compiled with the
160 .SB QUOTA
161 option.
162 .TP
163 .SM ENOMEM
164 Insufficient memory to complete operation.
165 .TP
166 .SM ENOTTY
167 .I qc_cmd
168 is invalid.
169 .TP
170 .SM EBUSY
171 Cannot process during quotacheck.
172 .TP
173 .SM ENOENT
174 .I uuid
175 does not correspond to OBD or
176 .I mnt
177 does not exist
178 .TP
179 .SM EPERM
180 The call is privileged and the caller was not the super-user.
181 .TP
182 .SM ESRCH
183 No disc quota is found for the indicated user.
184 .IP
185 Quotas have not been turned on for this filesystem.
186 .SH "SEE ALSO"
187 .BR lfs (1),
188 .BR lustre (7),
189 .BR liblustreapi (7)