blob: 3ebb231536405d5c6e557f337692de98969d8c63 [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/fs.h>
11
Jan Kara03b06342008-07-25 01:46:52 -070012static inline struct quota_info *sb_dqopt(struct super_block *sb)
13{
14 return &sb->s_dquot;
15}
Jan Kara74abb982008-07-25 01:46:51 -070016
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#if defined(CONFIG_QUOTA)
18
19/*
20 * declaration of quota_function calls in kernel.
21 */
Christoph Hellwig850b2012009-04-27 16:43:54 +020022void sync_quota_sb(struct super_block *sb, int type);
Jan Karac3f8a402009-04-27 16:43:55 +020023static inline void writeout_quota_sb(struct super_block *sb, int type)
24{
25 if (sb->s_qcop->quota_sync)
26 sb->s_qcop->quota_sync(sb, type);
27}
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Jan Karab85f4b82008-07-25 01:46:50 -070029int dquot_initialize(struct inode *inode, int type);
30int dquot_drop(struct inode *inode);
Jan Kara3d9ea252008-10-10 16:12:23 +020031struct dquot *dqget(struct super_block *sb, unsigned int id, int type);
32void dqput(struct dquot *dquot);
Jan Kara12c77522008-10-20 17:05:00 +020033int dquot_scan_active(struct super_block *sb,
34 int (*fn)(struct dquot *dquot, unsigned long priv),
35 unsigned long priv);
Jan Kara7d9056b2008-11-25 15:31:32 +010036struct dquot *dquot_alloc(struct super_block *sb, int type);
37void dquot_destroy(struct dquot *dquot);
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
Jan Karab85f4b82008-07-25 01:46:50 -070039int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc);
Jan Kara12095462008-08-20 14:45:12 +020040int dquot_alloc_inode(const struct inode *inode, qsize_t number);
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Mingming Cao740d9dc2009-01-13 16:43:14 +010042int dquot_reserve_space(struct inode *inode, qsize_t number, int prealloc);
43int dquot_claim_space(struct inode *inode, qsize_t number);
44void dquot_release_reserved_space(struct inode *inode, qsize_t number);
45qsize_t dquot_get_reserved_space(struct inode *inode);
46
Jan Karab85f4b82008-07-25 01:46:50 -070047int dquot_free_space(struct inode *inode, qsize_t number);
Jan Kara12095462008-08-20 14:45:12 +020048int dquot_free_inode(const struct inode *inode, qsize_t number);
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
Jan Karab85f4b82008-07-25 01:46:50 -070050int dquot_transfer(struct inode *inode, struct iattr *iattr);
51int dquot_commit(struct dquot *dquot);
52int dquot_acquire(struct dquot *dquot);
53int dquot_release(struct dquot *dquot);
54int dquot_commit_info(struct super_block *sb, int type);
55int dquot_mark_dquot_dirty(struct dquot *dquot);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
Jan Karab85f4b82008-07-25 01:46:50 -070057int vfs_quota_on(struct super_block *sb, int type, int format_id,
58 char *path, int remount);
Jan Karaf55abc02008-08-20 17:50:32 +020059int vfs_quota_enable(struct inode *inode, int type, int format_id,
60 unsigned int flags);
Al Viro77e69da2008-08-01 04:29:18 -040061int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
62 struct path *path);
Jan Karab85f4b82008-07-25 01:46:50 -070063int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
64 int format_id, int type);
65int vfs_quota_off(struct super_block *sb, int type, int remount);
Jan Karaf55abc02008-08-20 17:50:32 +020066int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags);
Jan Karab85f4b82008-07-25 01:46:50 -070067int vfs_quota_sync(struct super_block *sb, int type);
68int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
69int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
70int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
71int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
72
73void vfs_dq_drop(struct inode *inode);
74int vfs_dq_transfer(struct inode *inode, struct iattr *iattr);
75int vfs_dq_quota_on_remount(struct super_block *sb);
Linus Torvalds1da177e2005-04-16 15:20:36 -070076
Jan Kara03b06342008-07-25 01:46:52 -070077static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
78{
79 return sb_dqopt(sb)->info + type;
80}
Jan Kara74abb982008-07-25 01:46:51 -070081
82/*
83 * Functions for checking status of quota
84 */
85
Jan Karaf55abc02008-08-20 17:50:32 +020086static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
Jan Kara03b06342008-07-25 01:46:52 -070087{
Jan Karaf55abc02008-08-20 17:50:32 +020088 return sb_dqopt(sb)->flags &
89 dquot_state_flag(DQUOT_USAGE_ENABLED, type);
Jan Kara03b06342008-07-25 01:46:52 -070090}
Jan Kara74abb982008-07-25 01:46:51 -070091
Jan Karaf55abc02008-08-20 17:50:32 +020092static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
Jan Kara03b06342008-07-25 01:46:52 -070093{
Jan Karaf55abc02008-08-20 17:50:32 +020094 return sb_dqopt(sb)->flags &
95 dquot_state_flag(DQUOT_LIMITS_ENABLED, type);
Jan Kara03b06342008-07-25 01:46:52 -070096}
Jan Kara74abb982008-07-25 01:46:51 -070097
Jan Kara03b06342008-07-25 01:46:52 -070098static inline int sb_has_quota_suspended(struct super_block *sb, int type)
99{
Jan Karaf55abc02008-08-20 17:50:32 +0200100 return sb_dqopt(sb)->flags &
101 dquot_state_flag(DQUOT_SUSPENDED, type);
Jan Kara03b06342008-07-25 01:46:52 -0700102}
Jan Kara74abb982008-07-25 01:46:51 -0700103
Jan Kara03b06342008-07-25 01:46:52 -0700104static inline int sb_any_quota_suspended(struct super_block *sb)
105{
106 return sb_has_quota_suspended(sb, USRQUOTA) ||
107 sb_has_quota_suspended(sb, GRPQUOTA);
108}
Jan Kara74abb982008-07-25 01:46:51 -0700109
Jan Karaf55abc02008-08-20 17:50:32 +0200110/* Does kernel know about any quota information for given sb + type? */
111static inline int sb_has_quota_loaded(struct super_block *sb, int type)
112{
113 /* Currently if anything is on, then quota usage is on as well */
114 return sb_has_quota_usage_enabled(sb, type);
115}
116
117static inline int sb_any_quota_loaded(struct super_block *sb)
118{
119 return sb_has_quota_loaded(sb, USRQUOTA) ||
120 sb_has_quota_loaded(sb, GRPQUOTA);
121}
122
123static inline int sb_has_quota_active(struct super_block *sb, int type)
124{
125 return sb_has_quota_loaded(sb, type) &&
126 !sb_has_quota_suspended(sb, type);
127}
128
129static inline int sb_any_quota_active(struct super_block *sb)
130{
131 return sb_has_quota_active(sb, USRQUOTA) ||
132 sb_has_quota_active(sb, GRPQUOTA);
133}
134
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135/*
136 * Operations supported for diskquotas.
137 */
Alexey Dobriyan61e225d2009-09-21 17:01:08 -0700138extern const struct dquot_operations dquot_operations;
Alexey Dobriyan0d54b212009-09-21 17:01:09 -0700139extern const struct quotactl_ops vfs_quotactl_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140
141#define sb_dquot_ops (&dquot_operations)
142#define sb_quotactl_ops (&vfs_quotactl_ops)
143
144/* It is better to call this function outside of any transaction as it might
145 * need a lot of space in journal for dquot structure allocation. */
Jan Karab85f4b82008-07-25 01:46:50 -0700146static inline void vfs_dq_init(struct inode *inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147{
148 BUG_ON(!inode->i_sb);
Jan Karaf55abc02008-08-20 17:50:32 +0200149 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150 inode->i_sb->dq_op->initialize(inode, -1);
151}
152
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153/* The following allocation/freeing/transfer functions *must* be called inside
154 * a transaction (deadlocks possible otherwise) */
Jan Karab85f4b82008-07-25 01:46:50 -0700155static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156{
Jan Karaf55abc02008-08-20 17:50:32 +0200157 if (sb_any_quota_active(inode->i_sb)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158 /* Used space is updated in alloc_space() */
159 if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA)
160 return 1;
161 }
162 else
163 inode_add_bytes(inode, nr);
164 return 0;
165}
166
Jan Karab85f4b82008-07-25 01:46:50 -0700167static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168{
169 int ret;
Jan Karab85f4b82008-07-25 01:46:50 -0700170 if (!(ret = vfs_dq_prealloc_space_nodirty(inode, nr)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171 mark_inode_dirty(inode);
172 return ret;
173}
174
Jan Karab85f4b82008-07-25 01:46:50 -0700175static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176{
Jan Karaf55abc02008-08-20 17:50:32 +0200177 if (sb_any_quota_active(inode->i_sb)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178 /* Used space is updated in alloc_space() */
179 if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA)
180 return 1;
181 }
182 else
183 inode_add_bytes(inode, nr);
184 return 0;
185}
186
Jan Karab85f4b82008-07-25 01:46:50 -0700187static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188{
189 int ret;
Jan Karab85f4b82008-07-25 01:46:50 -0700190 if (!(ret = vfs_dq_alloc_space_nodirty(inode, nr)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191 mark_inode_dirty(inode);
192 return ret;
193}
194
Mingming Caof18df222009-01-13 16:43:09 +0100195static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
196{
197 if (sb_any_quota_active(inode->i_sb)) {
198 /* Used space is updated in alloc_space() */
199 if (inode->i_sb->dq_op->reserve_space(inode, nr, 0) == NO_QUOTA)
200 return 1;
201 }
202 return 0;
203}
204
Jan Karab85f4b82008-07-25 01:46:50 -0700205static inline int vfs_dq_alloc_inode(struct inode *inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206{
Jan Karaf55abc02008-08-20 17:50:32 +0200207 if (sb_any_quota_active(inode->i_sb)) {
Jan Karab85f4b82008-07-25 01:46:50 -0700208 vfs_dq_init(inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
210 return 1;
211 }
212 return 0;
213}
214
Mingming Cao740d9dc2009-01-13 16:43:14 +0100215/*
216 * Convert in-memory reserved quotas to real consumed quotas
217 */
218static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
219{
220 if (sb_any_quota_active(inode->i_sb)) {
221 if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA)
222 return 1;
223 } else
224 inode_add_bytes(inode, nr);
225
226 mark_inode_dirty(inode);
227 return 0;
228}
229
230/*
231 * Release reserved (in-memory) quotas
232 */
233static inline
234void vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
235{
236 if (sb_any_quota_active(inode->i_sb))
237 inode->i_sb->dq_op->release_rsv(inode, nr);
238}
239
Jan Karab85f4b82008-07-25 01:46:50 -0700240static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241{
Jan Karaf55abc02008-08-20 17:50:32 +0200242 if (sb_any_quota_active(inode->i_sb))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243 inode->i_sb->dq_op->free_space(inode, nr);
244 else
245 inode_sub_bytes(inode, nr);
246}
247
Jan Karab85f4b82008-07-25 01:46:50 -0700248static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249{
Jan Karab85f4b82008-07-25 01:46:50 -0700250 vfs_dq_free_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251 mark_inode_dirty(inode);
252}
253
Jan Karab85f4b82008-07-25 01:46:50 -0700254static inline void vfs_dq_free_inode(struct inode *inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255{
Jan Karaf55abc02008-08-20 17:50:32 +0200256 if (sb_any_quota_active(inode->i_sb))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257 inode->i_sb->dq_op->free_inode(inode, 1);
258}
259
Christoph Hellwig850b2012009-04-27 16:43:54 +0200260/* Cannot be called inside a transaction */
Jan Karab85f4b82008-07-25 01:46:50 -0700261static inline int vfs_dq_off(struct super_block *sb, int remount)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262{
263 int ret = -ENOSYS;
264
Jan Kara0ff5af82008-04-28 02:14:33 -0700265 if (sb->s_qcop && sb->s_qcop->quota_off)
266 ret = sb->s_qcop->quota_off(sb, -1, remount);
267 return ret;
268}
269
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270#else
271
Jan Karaf55abc02008-08-20 17:50:32 +0200272static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
Jan Kara03b06342008-07-25 01:46:52 -0700273{
274 return 0;
275}
276
Jan Karaf55abc02008-08-20 17:50:32 +0200277static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
Jan Kara03b06342008-07-25 01:46:52 -0700278{
279 return 0;
280}
281
282static inline int sb_has_quota_suspended(struct super_block *sb, int type)
283{
284 return 0;
285}
286
287static inline int sb_any_quota_suspended(struct super_block *sb)
288{
289 return 0;
290}
Jan Kara74abb982008-07-25 01:46:51 -0700291
Jan Karaf55abc02008-08-20 17:50:32 +0200292/* Does kernel know about any quota information for given sb + type? */
293static inline int sb_has_quota_loaded(struct super_block *sb, int type)
294{
295 return 0;
296}
297
298static inline int sb_any_quota_loaded(struct super_block *sb)
299{
300 return 0;
301}
302
303static inline int sb_has_quota_active(struct super_block *sb, int type)
304{
305 return 0;
306}
307
308static inline int sb_any_quota_active(struct super_block *sb)
309{
310 return 0;
311}
312
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313/*
314 * NO-OP when quota not configured.
315 */
316#define sb_dquot_ops (NULL)
317#define sb_quotactl_ops (NULL)
Andrew Morton50f8c372008-04-28 02:14:35 -0700318
Jan Karab85f4b82008-07-25 01:46:50 -0700319static inline void vfs_dq_init(struct inode *inode)
Andrew Morton50f8c372008-04-28 02:14:35 -0700320{
321}
322
Jan Karab85f4b82008-07-25 01:46:50 -0700323static inline void vfs_dq_drop(struct inode *inode)
Andrew Morton50f8c372008-04-28 02:14:35 -0700324{
325}
326
Jan Karab85f4b82008-07-25 01:46:50 -0700327static inline int vfs_dq_alloc_inode(struct inode *inode)
Andrew Morton50f8c372008-04-28 02:14:35 -0700328{
329 return 0;
330}
331
Jan Karab85f4b82008-07-25 01:46:50 -0700332static inline void vfs_dq_free_inode(struct inode *inode)
Andrew Morton50f8c372008-04-28 02:14:35 -0700333{
334}
335
Christoph Hellwig850b2012009-04-27 16:43:54 +0200336static inline void sync_quota_sb(struct super_block *sb, int type)
Andrew Morton50f8c372008-04-28 02:14:35 -0700337{
338}
339
Jan Karac3f8a402009-04-27 16:43:55 +0200340static inline void writeout_quota_sb(struct super_block *sb, int type)
341{
342}
343
Jan Karab85f4b82008-07-25 01:46:50 -0700344static inline int vfs_dq_off(struct super_block *sb, int remount)
Andrew Morton50f8c372008-04-28 02:14:35 -0700345{
346 return 0;
347}
348
Jan Karab85f4b82008-07-25 01:46:50 -0700349static inline int vfs_dq_quota_on_remount(struct super_block *sb)
Andrew Morton50f8c372008-04-28 02:14:35 -0700350{
351 return 0;
352}
353
Jan Karab85f4b82008-07-25 01:46:50 -0700354static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr)
Andrew Morton50f8c372008-04-28 02:14:35 -0700355{
356 return 0;
357}
358
Jan Karab85f4b82008-07-25 01:46:50 -0700359static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360{
361 inode_add_bytes(inode, nr);
362 return 0;
363}
364
Jan Karab85f4b82008-07-25 01:46:50 -0700365static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366{
Jan Karab85f4b82008-07-25 01:46:50 -0700367 vfs_dq_prealloc_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368 mark_inode_dirty(inode);
369 return 0;
370}
371
Jan Karab85f4b82008-07-25 01:46:50 -0700372static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373{
374 inode_add_bytes(inode, nr);
375 return 0;
376}
377
Jan Karab85f4b82008-07-25 01:46:50 -0700378static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379{
Jan Karab85f4b82008-07-25 01:46:50 -0700380 vfs_dq_alloc_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700381 mark_inode_dirty(inode);
382 return 0;
383}
384
Mingming Caof18df222009-01-13 16:43:09 +0100385static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
386{
387 return 0;
388}
389
Mingming Cao740d9dc2009-01-13 16:43:14 +0100390static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
391{
392 return vfs_dq_alloc_space(inode, nr);
393}
394
395static inline
396int vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
397{
398 return 0;
399}
400
Jan Karab85f4b82008-07-25 01:46:50 -0700401static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402{
403 inode_sub_bytes(inode, nr);
404}
405
Jan Karab85f4b82008-07-25 01:46:50 -0700406static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407{
Jan Karab85f4b82008-07-25 01:46:50 -0700408 vfs_dq_free_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409 mark_inode_dirty(inode);
410}
411
412#endif /* CONFIG_QUOTA */
413
Jan Karab85f4b82008-07-25 01:46:50 -0700414static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700415{
Mingming Cao9900ba32009-01-14 16:18:57 +0100416 return vfs_dq_prealloc_space_nodirty(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700417}
418
Jan Karab85f4b82008-07-25 01:46:50 -0700419static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700420{
Mingming Cao9900ba32009-01-14 16:18:57 +0100421 return vfs_dq_prealloc_space(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700422}
423
Jan Karab85f4b82008-07-25 01:46:50 -0700424static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700425{
Mingming Cao9900ba32009-01-14 16:18:57 +0100426 return vfs_dq_alloc_space_nodirty(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700427}
428
Jan Karab85f4b82008-07-25 01:46:50 -0700429static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700430{
Mingming Cao9900ba32009-01-14 16:18:57 +0100431 return vfs_dq_alloc_space(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700432}
433
Mingming Caof18df222009-01-13 16:43:09 +0100434static inline int vfs_dq_reserve_block(struct inode *inode, qsize_t nr)
435{
Mingming Cao9900ba32009-01-14 16:18:57 +0100436 return vfs_dq_reserve_space(inode, nr << inode->i_blkbits);
Mingming Caof18df222009-01-13 16:43:09 +0100437}
438
Mingming Cao740d9dc2009-01-13 16:43:14 +0100439static inline int vfs_dq_claim_block(struct inode *inode, qsize_t nr)
440{
Mingming Cao9900ba32009-01-14 16:18:57 +0100441 return vfs_dq_claim_space(inode, nr << inode->i_blkbits);
Mingming Cao740d9dc2009-01-13 16:43:14 +0100442}
443
444static inline
445void vfs_dq_release_reservation_block(struct inode *inode, qsize_t nr)
446{
447 vfs_dq_release_reservation_space(inode, nr << inode->i_blkbits);
448}
449
Jan Karab85f4b82008-07-25 01:46:50 -0700450static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700451{
Mingming Cao9900ba32009-01-14 16:18:57 +0100452 vfs_dq_free_space_nodirty(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700453}
454
Jan Karab85f4b82008-07-25 01:46:50 -0700455static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700456{
Mingming Cao9900ba32009-01-14 16:18:57 +0100457 vfs_dq_free_space(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700458}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460#endif /* _LINUX_QUOTAOPS_ */