blob: 7bc457593684aaad13a4e27b0759066832f130f0 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Definitions for diskquota-operations. When diskquota is configured these
3 * macros expand to the right source-code.
4 *
5 * Author: Marco van Wieringen <mvw@planets.elm.net>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 */
7#ifndef _LINUX_QUOTAOPS_
8#define _LINUX_QUOTAOPS_
9
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/smp_lock.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <linux/fs.h>
12
Jan Kara03b06342008-07-25 01:46:52 -070013static inline struct quota_info *sb_dqopt(struct super_block *sb)
14{
15 return &sb->s_dquot;
16}
Jan Kara74abb982008-07-25 01:46:51 -070017
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#if defined(CONFIG_QUOTA)
19
20/*
21 * declaration of quota_function calls in kernel.
22 */
Christoph Hellwig850b2012009-04-27 16:43:54 +020023void sync_quota_sb(struct super_block *sb, int type);
Jan Karac3f8a402009-04-27 16:43:55 +020024static inline void writeout_quota_sb(struct super_block *sb, int type)
25{
26 if (sb->s_qcop->quota_sync)
27 sb->s_qcop->quota_sync(sb, type);
28}
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
Jan Karab85f4b82008-07-25 01:46:50 -070030int dquot_initialize(struct inode *inode, int type);
31int dquot_drop(struct inode *inode);
Jan Kara3d9ea252008-10-10 16:12:23 +020032struct dquot *dqget(struct super_block *sb, unsigned int id, int type);
33void dqput(struct dquot *dquot);
Jan Kara12c77522008-10-20 17:05:00 +020034int dquot_scan_active(struct super_block *sb,
35 int (*fn)(struct dquot *dquot, unsigned long priv),
36 unsigned long priv);
Jan Kara7d9056b2008-11-25 15:31:32 +010037struct dquot *dquot_alloc(struct super_block *sb, int type);
38void dquot_destroy(struct dquot *dquot);
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Jan Karab85f4b82008-07-25 01:46:50 -070040int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc);
Jan Kara12095462008-08-20 14:45:12 +020041int dquot_alloc_inode(const struct inode *inode, qsize_t number);
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
Mingming Cao740d9dc2009-01-13 16:43:14 +010043int dquot_reserve_space(struct inode *inode, qsize_t number, int prealloc);
44int dquot_claim_space(struct inode *inode, qsize_t number);
45void dquot_release_reserved_space(struct inode *inode, qsize_t number);
46qsize_t dquot_get_reserved_space(struct inode *inode);
47
Jan Karab85f4b82008-07-25 01:46:50 -070048int dquot_free_space(struct inode *inode, qsize_t number);
Jan Kara12095462008-08-20 14:45:12 +020049int dquot_free_inode(const struct inode *inode, qsize_t number);
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
Jan Karab85f4b82008-07-25 01:46:50 -070051int dquot_transfer(struct inode *inode, struct iattr *iattr);
52int dquot_commit(struct dquot *dquot);
53int dquot_acquire(struct dquot *dquot);
54int dquot_release(struct dquot *dquot);
55int dquot_commit_info(struct super_block *sb, int type);
56int dquot_mark_dquot_dirty(struct dquot *dquot);
Linus Torvalds1da177e2005-04-16 15:20:36 -070057
Jan Karab85f4b82008-07-25 01:46:50 -070058int vfs_quota_on(struct super_block *sb, int type, int format_id,
59 char *path, int remount);
Jan Karaf55abc02008-08-20 17:50:32 +020060int vfs_quota_enable(struct inode *inode, int type, int format_id,
61 unsigned int flags);
Al Viro77e69da2008-08-01 04:29:18 -040062int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
63 struct path *path);
Jan Karab85f4b82008-07-25 01:46:50 -070064int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
65 int format_id, int type);
66int vfs_quota_off(struct super_block *sb, int type, int remount);
Jan Karaf55abc02008-08-20 17:50:32 +020067int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags);
Jan Karab85f4b82008-07-25 01:46:50 -070068int vfs_quota_sync(struct super_block *sb, int type);
69int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
70int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
71int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
72int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
73
74void vfs_dq_drop(struct inode *inode);
75int vfs_dq_transfer(struct inode *inode, struct iattr *iattr);
76int vfs_dq_quota_on_remount(struct super_block *sb);
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
Jan Kara03b06342008-07-25 01:46:52 -070078static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
79{
80 return sb_dqopt(sb)->info + type;
81}
Jan Kara74abb982008-07-25 01:46:51 -070082
83/*
84 * Functions for checking status of quota
85 */
86
Jan Karaf55abc02008-08-20 17:50:32 +020087static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
Jan Kara03b06342008-07-25 01:46:52 -070088{
Jan Karaf55abc02008-08-20 17:50:32 +020089 return sb_dqopt(sb)->flags &
90 dquot_state_flag(DQUOT_USAGE_ENABLED, type);
Jan Kara03b06342008-07-25 01:46:52 -070091}
Jan Kara74abb982008-07-25 01:46:51 -070092
Jan Karaf55abc02008-08-20 17:50:32 +020093static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
Jan Kara03b06342008-07-25 01:46:52 -070094{
Jan Karaf55abc02008-08-20 17:50:32 +020095 return sb_dqopt(sb)->flags &
96 dquot_state_flag(DQUOT_LIMITS_ENABLED, type);
Jan Kara03b06342008-07-25 01:46:52 -070097}
Jan Kara74abb982008-07-25 01:46:51 -070098
Jan Kara03b06342008-07-25 01:46:52 -070099static inline int sb_has_quota_suspended(struct super_block *sb, int type)
100{
Jan Karaf55abc02008-08-20 17:50:32 +0200101 return sb_dqopt(sb)->flags &
102 dquot_state_flag(DQUOT_SUSPENDED, type);
Jan Kara03b06342008-07-25 01:46:52 -0700103}
Jan Kara74abb982008-07-25 01:46:51 -0700104
Jan Kara03b06342008-07-25 01:46:52 -0700105static inline int sb_any_quota_suspended(struct super_block *sb)
106{
107 return sb_has_quota_suspended(sb, USRQUOTA) ||
108 sb_has_quota_suspended(sb, GRPQUOTA);
109}
Jan Kara74abb982008-07-25 01:46:51 -0700110
Jan Karaf55abc02008-08-20 17:50:32 +0200111/* Does kernel know about any quota information for given sb + type? */
112static inline int sb_has_quota_loaded(struct super_block *sb, int type)
113{
114 /* Currently if anything is on, then quota usage is on as well */
115 return sb_has_quota_usage_enabled(sb, type);
116}
117
118static inline int sb_any_quota_loaded(struct super_block *sb)
119{
120 return sb_has_quota_loaded(sb, USRQUOTA) ||
121 sb_has_quota_loaded(sb, GRPQUOTA);
122}
123
124static inline int sb_has_quota_active(struct super_block *sb, int type)
125{
126 return sb_has_quota_loaded(sb, type) &&
127 !sb_has_quota_suspended(sb, type);
128}
129
130static inline int sb_any_quota_active(struct super_block *sb)
131{
132 return sb_has_quota_active(sb, USRQUOTA) ||
133 sb_has_quota_active(sb, GRPQUOTA);
134}
135
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136/*
137 * Operations supported for diskquotas.
138 */
139extern struct dquot_operations dquot_operations;
140extern struct quotactl_ops vfs_quotactl_ops;
141
142#define sb_dquot_ops (&dquot_operations)
143#define sb_quotactl_ops (&vfs_quotactl_ops)
144
145/* It is better to call this function outside of any transaction as it might
146 * need a lot of space in journal for dquot structure allocation. */
Jan Karab85f4b82008-07-25 01:46:50 -0700147static inline void vfs_dq_init(struct inode *inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148{
149 BUG_ON(!inode->i_sb);
Jan Karaf55abc02008-08-20 17:50:32 +0200150 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 inode->i_sb->dq_op->initialize(inode, -1);
152}
153
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154/* The following allocation/freeing/transfer functions *must* be called inside
155 * a transaction (deadlocks possible otherwise) */
Jan Karab85f4b82008-07-25 01:46:50 -0700156static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157{
Jan Karaf55abc02008-08-20 17:50:32 +0200158 if (sb_any_quota_active(inode->i_sb)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159 /* Used space is updated in alloc_space() */
160 if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA)
161 return 1;
162 }
163 else
164 inode_add_bytes(inode, nr);
165 return 0;
166}
167
Jan Karab85f4b82008-07-25 01:46:50 -0700168static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169{
170 int ret;
Jan Karab85f4b82008-07-25 01:46:50 -0700171 if (!(ret = vfs_dq_prealloc_space_nodirty(inode, nr)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172 mark_inode_dirty(inode);
173 return ret;
174}
175
Jan Karab85f4b82008-07-25 01:46:50 -0700176static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177{
Jan Karaf55abc02008-08-20 17:50:32 +0200178 if (sb_any_quota_active(inode->i_sb)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179 /* Used space is updated in alloc_space() */
180 if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA)
181 return 1;
182 }
183 else
184 inode_add_bytes(inode, nr);
185 return 0;
186}
187
Jan Karab85f4b82008-07-25 01:46:50 -0700188static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189{
190 int ret;
Jan Karab85f4b82008-07-25 01:46:50 -0700191 if (!(ret = vfs_dq_alloc_space_nodirty(inode, nr)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192 mark_inode_dirty(inode);
193 return ret;
194}
195
Mingming Caof18df222009-01-13 16:43:09 +0100196static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
197{
198 if (sb_any_quota_active(inode->i_sb)) {
199 /* Used space is updated in alloc_space() */
200 if (inode->i_sb->dq_op->reserve_space(inode, nr, 0) == NO_QUOTA)
201 return 1;
202 }
203 return 0;
204}
205
Jan Karab85f4b82008-07-25 01:46:50 -0700206static inline int vfs_dq_alloc_inode(struct inode *inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207{
Jan Karaf55abc02008-08-20 17:50:32 +0200208 if (sb_any_quota_active(inode->i_sb)) {
Jan Karab85f4b82008-07-25 01:46:50 -0700209 vfs_dq_init(inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
211 return 1;
212 }
213 return 0;
214}
215
Mingming Cao740d9dc2009-01-13 16:43:14 +0100216/*
217 * Convert in-memory reserved quotas to real consumed quotas
218 */
219static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
220{
221 if (sb_any_quota_active(inode->i_sb)) {
222 if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA)
223 return 1;
224 } else
225 inode_add_bytes(inode, nr);
226
227 mark_inode_dirty(inode);
228 return 0;
229}
230
231/*
232 * Release reserved (in-memory) quotas
233 */
234static inline
235void vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
236{
237 if (sb_any_quota_active(inode->i_sb))
238 inode->i_sb->dq_op->release_rsv(inode, nr);
239}
240
Jan Karab85f4b82008-07-25 01:46:50 -0700241static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242{
Jan Karaf55abc02008-08-20 17:50:32 +0200243 if (sb_any_quota_active(inode->i_sb))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244 inode->i_sb->dq_op->free_space(inode, nr);
245 else
246 inode_sub_bytes(inode, nr);
247}
248
Jan Karab85f4b82008-07-25 01:46:50 -0700249static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250{
Jan Karab85f4b82008-07-25 01:46:50 -0700251 vfs_dq_free_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 mark_inode_dirty(inode);
253}
254
Jan Karab85f4b82008-07-25 01:46:50 -0700255static inline void vfs_dq_free_inode(struct inode *inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256{
Jan Karaf55abc02008-08-20 17:50:32 +0200257 if (sb_any_quota_active(inode->i_sb))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258 inode->i_sb->dq_op->free_inode(inode, 1);
259}
260
Christoph Hellwig850b2012009-04-27 16:43:54 +0200261/* Cannot be called inside a transaction */
Jan Karab85f4b82008-07-25 01:46:50 -0700262static inline int vfs_dq_off(struct super_block *sb, int remount)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263{
264 int ret = -ENOSYS;
265
Jan Kara0ff5af82008-04-28 02:14:33 -0700266 if (sb->s_qcop && sb->s_qcop->quota_off)
267 ret = sb->s_qcop->quota_off(sb, -1, remount);
268 return ret;
269}
270
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271#else
272
Jan Karaf55abc02008-08-20 17:50:32 +0200273static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
Jan Kara03b06342008-07-25 01:46:52 -0700274{
275 return 0;
276}
277
Jan Karaf55abc02008-08-20 17:50:32 +0200278static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
Jan Kara03b06342008-07-25 01:46:52 -0700279{
280 return 0;
281}
282
283static inline int sb_has_quota_suspended(struct super_block *sb, int type)
284{
285 return 0;
286}
287
288static inline int sb_any_quota_suspended(struct super_block *sb)
289{
290 return 0;
291}
Jan Kara74abb982008-07-25 01:46:51 -0700292
Jan Karaf55abc02008-08-20 17:50:32 +0200293/* Does kernel know about any quota information for given sb + type? */
294static inline int sb_has_quota_loaded(struct super_block *sb, int type)
295{
296 return 0;
297}
298
299static inline int sb_any_quota_loaded(struct super_block *sb)
300{
301 return 0;
302}
303
304static inline int sb_has_quota_active(struct super_block *sb, int type)
305{
306 return 0;
307}
308
309static inline int sb_any_quota_active(struct super_block *sb)
310{
311 return 0;
312}
313
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314/*
315 * NO-OP when quota not configured.
316 */
317#define sb_dquot_ops (NULL)
318#define sb_quotactl_ops (NULL)
Andrew Morton50f8c372008-04-28 02:14:35 -0700319
Jan Karab85f4b82008-07-25 01:46:50 -0700320static inline void vfs_dq_init(struct inode *inode)
Andrew Morton50f8c372008-04-28 02:14:35 -0700321{
322}
323
Jan Karab85f4b82008-07-25 01:46:50 -0700324static inline void vfs_dq_drop(struct inode *inode)
Andrew Morton50f8c372008-04-28 02:14:35 -0700325{
326}
327
Jan Karab85f4b82008-07-25 01:46:50 -0700328static inline int vfs_dq_alloc_inode(struct inode *inode)
Andrew Morton50f8c372008-04-28 02:14:35 -0700329{
330 return 0;
331}
332
Jan Karab85f4b82008-07-25 01:46:50 -0700333static inline void vfs_dq_free_inode(struct inode *inode)
Andrew Morton50f8c372008-04-28 02:14:35 -0700334{
335}
336
Christoph Hellwig850b2012009-04-27 16:43:54 +0200337static inline void sync_quota_sb(struct super_block *sb, int type)
Andrew Morton50f8c372008-04-28 02:14:35 -0700338{
339}
340
Jan Karac3f8a402009-04-27 16:43:55 +0200341static inline void writeout_quota_sb(struct super_block *sb, int type)
342{
343}
344
Jan Karab85f4b82008-07-25 01:46:50 -0700345static inline int vfs_dq_off(struct super_block *sb, int remount)
Andrew Morton50f8c372008-04-28 02:14:35 -0700346{
347 return 0;
348}
349
Jan Karab85f4b82008-07-25 01:46:50 -0700350static inline int vfs_dq_quota_on_remount(struct super_block *sb)
Andrew Morton50f8c372008-04-28 02:14:35 -0700351{
352 return 0;
353}
354
Jan Karab85f4b82008-07-25 01:46:50 -0700355static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr)
Andrew Morton50f8c372008-04-28 02:14:35 -0700356{
357 return 0;
358}
359
Jan Karab85f4b82008-07-25 01:46:50 -0700360static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361{
362 inode_add_bytes(inode, nr);
363 return 0;
364}
365
Jan Karab85f4b82008-07-25 01:46:50 -0700366static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367{
Jan Karab85f4b82008-07-25 01:46:50 -0700368 vfs_dq_prealloc_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369 mark_inode_dirty(inode);
370 return 0;
371}
372
Jan Karab85f4b82008-07-25 01:46:50 -0700373static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374{
375 inode_add_bytes(inode, nr);
376 return 0;
377}
378
Jan Karab85f4b82008-07-25 01:46:50 -0700379static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380{
Jan Karab85f4b82008-07-25 01:46:50 -0700381 vfs_dq_alloc_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382 mark_inode_dirty(inode);
383 return 0;
384}
385
Mingming Caof18df222009-01-13 16:43:09 +0100386static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
387{
388 return 0;
389}
390
Mingming Cao740d9dc2009-01-13 16:43:14 +0100391static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
392{
393 return vfs_dq_alloc_space(inode, nr);
394}
395
396static inline
397int vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
398{
399 return 0;
400}
401
Jan Karab85f4b82008-07-25 01:46:50 -0700402static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403{
404 inode_sub_bytes(inode, nr);
405}
406
Jan Karab85f4b82008-07-25 01:46:50 -0700407static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408{
Jan Karab85f4b82008-07-25 01:46:50 -0700409 vfs_dq_free_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700410 mark_inode_dirty(inode);
411}
412
413#endif /* CONFIG_QUOTA */
414
Jan Karab85f4b82008-07-25 01:46:50 -0700415static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700416{
Mingming Cao9900ba32009-01-14 16:18:57 +0100417 return vfs_dq_prealloc_space_nodirty(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700418}
419
Jan Karab85f4b82008-07-25 01:46:50 -0700420static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700421{
Mingming Cao9900ba32009-01-14 16:18:57 +0100422 return vfs_dq_prealloc_space(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700423}
424
Jan Karab85f4b82008-07-25 01:46:50 -0700425static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700426{
Mingming Cao9900ba32009-01-14 16:18:57 +0100427 return vfs_dq_alloc_space_nodirty(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700428}
429
Jan Karab85f4b82008-07-25 01:46:50 -0700430static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700431{
Mingming Cao9900ba32009-01-14 16:18:57 +0100432 return vfs_dq_alloc_space(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700433}
434
Mingming Caof18df222009-01-13 16:43:09 +0100435static inline int vfs_dq_reserve_block(struct inode *inode, qsize_t nr)
436{
Mingming Cao9900ba32009-01-14 16:18:57 +0100437 return vfs_dq_reserve_space(inode, nr << inode->i_blkbits);
Mingming Caof18df222009-01-13 16:43:09 +0100438}
439
Mingming Cao740d9dc2009-01-13 16:43:14 +0100440static inline int vfs_dq_claim_block(struct inode *inode, qsize_t nr)
441{
Mingming Cao9900ba32009-01-14 16:18:57 +0100442 return vfs_dq_claim_space(inode, nr << inode->i_blkbits);
Mingming Cao740d9dc2009-01-13 16:43:14 +0100443}
444
445static inline
446void vfs_dq_release_reservation_block(struct inode *inode, qsize_t nr)
447{
448 vfs_dq_release_reservation_space(inode, nr << inode->i_blkbits);
449}
450
Jan Karab85f4b82008-07-25 01:46:50 -0700451static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700452{
Mingming Cao9900ba32009-01-14 16:18:57 +0100453 vfs_dq_free_space_nodirty(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700454}
455
Jan Karab85f4b82008-07-25 01:46:50 -0700456static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700457{
Mingming Cao9900ba32009-01-14 16:18:57 +0100458 vfs_dq_free_space(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700459}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461#endif /* _LINUX_QUOTAOPS_ */