aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/quotaops.h
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2008-07-25 04:46:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:35 -0400
commitb85f4b87a511bea86dac68c4f0fabaee2cac6c4c (patch)
tree978e541e47effe07119862f04becbb4f79b02742 /include/linux/quotaops.h
parentb48d380541f634663b71766005838edbb7261685 (diff)
quota: rename quota functions from upper case, make bigger ones non-inline
Cleanup quotaops.h: Rename functions from uppercase to lowercase (and define backward compatibility macros), move larger functions to dquot.c and make them non-inline. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/quotaops.h')
-rw-r--r--include/linux/quotaops.h226
1 files changed, 107 insertions, 119 deletions
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index f86702053853..0c8f9fe462af 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -19,34 +19,38 @@
19/* 19/*
20 * declaration of quota_function calls in kernel. 20 * declaration of quota_function calls in kernel.
21 */ 21 */
22extern void sync_dquots(struct super_block *sb, int type); 22void sync_dquots(struct super_block *sb, int type);
23 23
24extern int dquot_initialize(struct inode *inode, int type); 24int dquot_initialize(struct inode *inode, int type);
25extern int dquot_drop(struct inode *inode); 25int dquot_drop(struct inode *inode);
26 26
27extern int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); 27int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc);
28extern int dquot_alloc_inode(const struct inode *inode, unsigned long number); 28int dquot_alloc_inode(const struct inode *inode, unsigned long number);
29 29
30extern int dquot_free_space(struct inode *inode, qsize_t number); 30int dquot_free_space(struct inode *inode, qsize_t number);
31extern int dquot_free_inode(const struct inode *inode, unsigned long number); 31int dquot_free_inode(const struct inode *inode, unsigned long number);
32 32
33extern int dquot_transfer(struct inode *inode, struct iattr *iattr); 33int dquot_transfer(struct inode *inode, struct iattr *iattr);
34extern int dquot_commit(struct dquot *dquot); 34int dquot_commit(struct dquot *dquot);
35extern int dquot_acquire(struct dquot *dquot); 35int dquot_acquire(struct dquot *dquot);
36extern int dquot_release(struct dquot *dquot); 36int dquot_release(struct dquot *dquot);
37extern int dquot_commit_info(struct super_block *sb, int type); 37int dquot_commit_info(struct super_block *sb, int type);
38extern int dquot_mark_dquot_dirty(struct dquot *dquot); 38int dquot_mark_dquot_dirty(struct dquot *dquot);
39 39
40extern int vfs_quota_on(struct super_block *sb, int type, int format_id, 40int vfs_quota_on(struct super_block *sb, int type, int format_id,
41 char *path, int remount); 41 char *path, int remount);
42extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 42int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
43 int format_id, int type); 43 int format_id, int type);
44extern int vfs_quota_off(struct super_block *sb, int type, int remount); 44int vfs_quota_off(struct super_block *sb, int type, int remount);
45extern int vfs_quota_sync(struct super_block *sb, int type); 45int vfs_quota_sync(struct super_block *sb, int type);
46extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 46int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
47extern int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 47int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
48extern int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); 48int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
49extern int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); 49int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
50
51void vfs_dq_drop(struct inode *inode);
52int vfs_dq_transfer(struct inode *inode, struct iattr *iattr);
53int vfs_dq_quota_on_remount(struct super_block *sb);
50 54
51/* 55/*
52 * Operations supported for diskquotas. 56 * Operations supported for diskquotas.
@@ -59,38 +63,16 @@ extern struct quotactl_ops vfs_quotactl_ops;
59 63
60/* It is better to call this function outside of any transaction as it might 64/* It is better to call this function outside of any transaction as it might
61 * need a lot of space in journal for dquot structure allocation. */ 65 * need a lot of space in journal for dquot structure allocation. */
62static inline void DQUOT_INIT(struct inode *inode) 66static inline void vfs_dq_init(struct inode *inode)
63{ 67{
64 BUG_ON(!inode->i_sb); 68 BUG_ON(!inode->i_sb);
65 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) 69 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode))
66 inode->i_sb->dq_op->initialize(inode, -1); 70 inode->i_sb->dq_op->initialize(inode, -1);
67} 71}
68 72
69/* The same as with DQUOT_INIT */
70static inline void DQUOT_DROP(struct inode *inode)
71{
72 /* Here we can get arbitrary inode from clear_inode() so we have
73 * to be careful. OTOH we don't need locking as quota operations
74 * are allowed to change only at mount time */
75 if (!IS_NOQUOTA(inode) && inode->i_sb && inode->i_sb->dq_op
76 && inode->i_sb->dq_op->drop) {
77 int cnt;
78 /* Test before calling to rule out calls from proc and such
79 * where we are not allowed to block. Note that this is
80 * actually reliable test even without the lock - the caller
81 * must assure that nobody can come after the DQUOT_DROP and
82 * add quota pointers back anyway */
83 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
84 if (inode->i_dquot[cnt] != NODQUOT)
85 break;
86 if (cnt < MAXQUOTAS)
87 inode->i_sb->dq_op->drop(inode);
88 }
89}
90
91/* The following allocation/freeing/transfer functions *must* be called inside 73/* The following allocation/freeing/transfer functions *must* be called inside
92 * a transaction (deadlocks possible otherwise) */ 74 * a transaction (deadlocks possible otherwise) */
93static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 75static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
94{ 76{
95 if (sb_any_quota_enabled(inode->i_sb)) { 77 if (sb_any_quota_enabled(inode->i_sb)) {
96 /* Used space is updated in alloc_space() */ 78 /* Used space is updated in alloc_space() */
@@ -102,15 +84,15 @@ static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
102 return 0; 84 return 0;
103} 85}
104 86
105static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) 87static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
106{ 88{
107 int ret; 89 int ret;
108 if (!(ret = DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr))) 90 if (!(ret = vfs_dq_prealloc_space_nodirty(inode, nr)))
109 mark_inode_dirty(inode); 91 mark_inode_dirty(inode);
110 return ret; 92 return ret;
111} 93}
112 94
113static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 95static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
114{ 96{
115 if (sb_any_quota_enabled(inode->i_sb)) { 97 if (sb_any_quota_enabled(inode->i_sb)) {
116 /* Used space is updated in alloc_space() */ 98 /* Used space is updated in alloc_space() */
@@ -122,25 +104,25 @@ static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
122 return 0; 104 return 0;
123} 105}
124 106
125static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) 107static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
126{ 108{
127 int ret; 109 int ret;
128 if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr))) 110 if (!(ret = vfs_dq_alloc_space_nodirty(inode, nr)))
129 mark_inode_dirty(inode); 111 mark_inode_dirty(inode);
130 return ret; 112 return ret;
131} 113}
132 114
133static inline int DQUOT_ALLOC_INODE(struct inode *inode) 115static inline int vfs_dq_alloc_inode(struct inode *inode)
134{ 116{
135 if (sb_any_quota_enabled(inode->i_sb)) { 117 if (sb_any_quota_enabled(inode->i_sb)) {
136 DQUOT_INIT(inode); 118 vfs_dq_init(inode);
137 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) 119 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
138 return 1; 120 return 1;
139 } 121 }
140 return 0; 122 return 0;
141} 123}
142 124
143static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 125static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
144{ 126{
145 if (sb_any_quota_enabled(inode->i_sb)) 127 if (sb_any_quota_enabled(inode->i_sb))
146 inode->i_sb->dq_op->free_space(inode, nr); 128 inode->i_sb->dq_op->free_space(inode, nr);
@@ -148,35 +130,25 @@ static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
148 inode_sub_bytes(inode, nr); 130 inode_sub_bytes(inode, nr);
149} 131}
150 132
151static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) 133static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
152{ 134{
153 DQUOT_FREE_SPACE_NODIRTY(inode, nr); 135 vfs_dq_free_space_nodirty(inode, nr);
154 mark_inode_dirty(inode); 136 mark_inode_dirty(inode);
155} 137}
156 138
157static inline void DQUOT_FREE_INODE(struct inode *inode) 139static inline void vfs_dq_free_inode(struct inode *inode)
158{ 140{
159 if (sb_any_quota_enabled(inode->i_sb)) 141 if (sb_any_quota_enabled(inode->i_sb))
160 inode->i_sb->dq_op->free_inode(inode, 1); 142 inode->i_sb->dq_op->free_inode(inode, 1);
161} 143}
162 144
163static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
164{
165 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) {
166 DQUOT_INIT(inode);
167 if (inode->i_sb->dq_op->transfer(inode, iattr) == NO_QUOTA)
168 return 1;
169 }
170 return 0;
171}
172
173/* The following two functions cannot be called inside a transaction */ 145/* The following two functions cannot be called inside a transaction */
174static inline void DQUOT_SYNC(struct super_block *sb) 146static inline void vfs_dq_sync(struct super_block *sb)
175{ 147{
176 sync_dquots(sb, -1); 148 sync_dquots(sb, -1);
177} 149}
178 150
179static inline int DQUOT_OFF(struct super_block *sb, int remount) 151static inline int vfs_dq_off(struct super_block *sb, int remount)
180{ 152{
181 int ret = -ENOSYS; 153 int ret = -ENOSYS;
182 154
@@ -185,21 +157,6 @@ static inline int DQUOT_OFF(struct super_block *sb, int remount)
185 return ret; 157 return ret;
186} 158}
187 159
188static inline int DQUOT_ON_REMOUNT(struct super_block *sb)
189{
190 int cnt;
191 int ret = 0, err;
192
193 if (!sb->s_qcop || !sb->s_qcop->quota_on)
194 return -ENOSYS;
195 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
196 err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1);
197 if (err < 0 && !ret)
198 ret = err;
199 }
200 return ret;
201}
202
203#else 160#else
204 161
205/* 162/*
@@ -208,113 +165,144 @@ static inline int DQUOT_ON_REMOUNT(struct super_block *sb)
208#define sb_dquot_ops (NULL) 165#define sb_dquot_ops (NULL)
209#define sb_quotactl_ops (NULL) 166#define sb_quotactl_ops (NULL)
210 167
211static inline void DQUOT_INIT(struct inode *inode) 168static inline void vfs_dq_init(struct inode *inode)
212{ 169{
213} 170}
214 171
215static inline void DQUOT_DROP(struct inode *inode) 172static inline void vfs_dq_drop(struct inode *inode)
216{ 173{
217} 174}
218 175
219static inline int DQUOT_ALLOC_INODE(struct inode *inode) 176static inline int vfs_dq_alloc_inode(struct inode *inode)
220{ 177{
221 return 0; 178 return 0;
222} 179}
223 180
224static inline void DQUOT_FREE_INODE(struct inode *inode) 181static inline void vfs_dq_free_inode(struct inode *inode)
225{ 182{
226} 183}
227 184
228static inline void DQUOT_SYNC(struct super_block *sb) 185static inline void vfs_dq_sync(struct super_block *sb)
229{ 186{
230} 187}
231 188
232static inline int DQUOT_OFF(struct super_block *sb, int remount) 189static inline int vfs_dq_off(struct super_block *sb, int remount)
233{ 190{
234 return 0; 191 return 0;
235} 192}
236 193
237static inline int DQUOT_ON_REMOUNT(struct super_block *sb) 194static inline int vfs_dq_quota_on_remount(struct super_block *sb)
238{ 195{
239 return 0; 196 return 0;
240} 197}
241 198
242static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr) 199static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr)
243{ 200{
244 return 0; 201 return 0;
245} 202}
246 203
247static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 204static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
248{ 205{
249 inode_add_bytes(inode, nr); 206 inode_add_bytes(inode, nr);
250 return 0; 207 return 0;
251} 208}
252 209
253static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) 210static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
254{ 211{
255 DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr); 212 vfs_dq_prealloc_space_nodirty(inode, nr);
256 mark_inode_dirty(inode); 213 mark_inode_dirty(inode);
257 return 0; 214 return 0;
258} 215}
259 216
260static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 217static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
261{ 218{
262 inode_add_bytes(inode, nr); 219 inode_add_bytes(inode, nr);
263 return 0; 220 return 0;
264} 221}
265 222
266static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) 223static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
267{ 224{
268 DQUOT_ALLOC_SPACE_NODIRTY(inode, nr); 225 vfs_dq_alloc_space_nodirty(inode, nr);
269 mark_inode_dirty(inode); 226 mark_inode_dirty(inode);
270 return 0; 227 return 0;
271} 228}
272 229
273static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 230static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
274{ 231{
275 inode_sub_bytes(inode, nr); 232 inode_sub_bytes(inode, nr);
276} 233}
277 234
278static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) 235static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
279{ 236{
280 DQUOT_FREE_SPACE_NODIRTY(inode, nr); 237 vfs_dq_free_space_nodirty(inode, nr);
281 mark_inode_dirty(inode); 238 mark_inode_dirty(inode);
282} 239}
283 240
284#endif /* CONFIG_QUOTA */ 241#endif /* CONFIG_QUOTA */
285 242
286static inline int DQUOT_PREALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr) 243static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr)
287{ 244{
288 return DQUOT_PREALLOC_SPACE_NODIRTY(inode, 245 return vfs_dq_prealloc_space_nodirty(inode,
289 nr << inode->i_sb->s_blocksize_bits); 246 nr << inode->i_sb->s_blocksize_bits);
290} 247}
291 248
292static inline int DQUOT_PREALLOC_BLOCK(struct inode *inode, qsize_t nr) 249static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr)
293{ 250{
294 return DQUOT_PREALLOC_SPACE(inode, 251 return vfs_dq_prealloc_space(inode,
295 nr << inode->i_sb->s_blocksize_bits); 252 nr << inode->i_sb->s_blocksize_bits);
296} 253}
297 254
298static inline int DQUOT_ALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr) 255static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr)
299{ 256{
300 return DQUOT_ALLOC_SPACE_NODIRTY(inode, 257 return vfs_dq_alloc_space_nodirty(inode,
301 nr << inode->i_sb->s_blocksize_bits); 258 nr << inode->i_sb->s_blocksize_bits);
302} 259}
303 260
304static inline int DQUOT_ALLOC_BLOCK(struct inode *inode, qsize_t nr) 261static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr)
305{ 262{
306 return DQUOT_ALLOC_SPACE(inode, 263 return vfs_dq_alloc_space(inode,
307 nr << inode->i_sb->s_blocksize_bits); 264 nr << inode->i_sb->s_blocksize_bits);
308} 265}
309 266
310static inline void DQUOT_FREE_BLOCK_NODIRTY(struct inode *inode, qsize_t nr) 267static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr)
311{ 268{
312 DQUOT_FREE_SPACE_NODIRTY(inode, nr << inode->i_sb->s_blocksize_bits); 269 vfs_dq_free_space_nodirty(inode, nr << inode->i_sb->s_blocksize_bits);
313} 270}
314 271
315static inline void DQUOT_FREE_BLOCK(struct inode *inode, qsize_t nr) 272static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr)
316{ 273{
317 DQUOT_FREE_SPACE(inode, nr << inode->i_sb->s_blocksize_bits); 274 vfs_dq_free_space(inode, nr << inode->i_sb->s_blocksize_bits);
318} 275}
319 276
277/*
278 * Define uppercase equivalents for compatibility with old function names
279 * Can go away when we think all users have been converted (15/04/2008)
280 */
281#define DQUOT_INIT(inode) vfs_dq_init(inode)
282#define DQUOT_DROP(inode) vfs_dq_drop(inode)
283#define DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr) \
284 vfs_dq_prealloc_space_nodirty(inode, nr)
285#define DQUOT_PREALLOC_SPACE(inode, nr) vfs_dq_prealloc_space(inode, nr)
286#define DQUOT_ALLOC_SPACE_NODIRTY(inode, nr) \
287 vfs_dq_alloc_space_nodirty(inode, nr)
288#define DQUOT_ALLOC_SPACE(inode, nr) vfs_dq_alloc_space(inode, nr)
289#define DQUOT_PREALLOC_BLOCK_NODIRTY(inode, nr) \
290 vfs_dq_prealloc_block_nodirty(inode, nr)
291#define DQUOT_PREALLOC_BLOCK(inode, nr) vfs_dq_prealloc_block(inode, nr)
292#define DQUOT_ALLOC_BLOCK_NODIRTY(inode, nr) \
293 vfs_dq_alloc_block_nodirty(inode, nr)
294#define DQUOT_ALLOC_BLOCK(inode, nr) vfs_dq_alloc_block(inode, nr)
295#define DQUOT_ALLOC_INODE(inode) vfs_dq_alloc_inode(inode)
296#define DQUOT_FREE_SPACE_NODIRTY(inode, nr) \
297 vfs_dq_free_space_nodirty(inode, nr)
298#define DQUOT_FREE_SPACE(inode, nr) vfs_dq_free_space(inode, nr)
299#define DQUOT_FREE_BLOCK_NODIRTY(inode, nr) \
300 vfs_dq_free_block_nodirty(inode, nr)
301#define DQUOT_FREE_BLOCK(inode, nr) vfs_dq_free_block(inode, nr)
302#define DQUOT_FREE_INODE(inode) vfs_dq_free_inode(inode)
303#define DQUOT_TRANSFER(inode, iattr) vfs_dq_transfer(inode, iattr)
304#define DQUOT_SYNC(sb) vfs_dq_sync(sb)
305#define DQUOT_OFF(sb, remount) vfs_dq_off(sb, remount)
306#define DQUOT_ON_REMOUNT(sb) vfs_dq_quota_on_remount(sb)
307
320#endif /* _LINUX_QUOTAOPS_ */ 308#endif /* _LINUX_QUOTAOPS_ */