blob: a529d86e7e73484080a32f2e9e24296aa22034ed [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
Dmitry Monakhovc4690702010-02-09 17:53:36 +010029void inode_add_rsv_space(struct inode *inode, qsize_t number);
30void inode_claim_rsv_space(struct inode *inode, qsize_t number);
31void inode_sub_rsv_space(struct inode *inode, qsize_t number);
32
Jan Karab85f4b82008-07-25 01:46:50 -070033int dquot_initialize(struct inode *inode, int type);
34int dquot_drop(struct inode *inode);
Jan Kara3d9ea252008-10-10 16:12:23 +020035struct dquot *dqget(struct super_block *sb, unsigned int id, int type);
36void dqput(struct dquot *dquot);
Jan Kara12c77522008-10-20 17:05:00 +020037int dquot_scan_active(struct super_block *sb,
38 int (*fn)(struct dquot *dquot, unsigned long priv),
39 unsigned long priv);
Jan Kara7d9056b2008-11-25 15:31:32 +010040struct dquot *dquot_alloc(struct super_block *sb, int type);
41void dquot_destroy(struct dquot *dquot);
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
Jan Karab85f4b82008-07-25 01:46:50 -070043int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc);
Jan Kara12095462008-08-20 14:45:12 +020044int dquot_alloc_inode(const struct inode *inode, qsize_t number);
Linus Torvalds1da177e2005-04-16 15:20:36 -070045
Mingming Cao740d9dc2009-01-13 16:43:14 +010046int dquot_reserve_space(struct inode *inode, qsize_t number, int prealloc);
47int dquot_claim_space(struct inode *inode, qsize_t number);
48void dquot_release_reserved_space(struct inode *inode, qsize_t number);
Mingming Cao740d9dc2009-01-13 16:43:14 +010049
Jan Karab85f4b82008-07-25 01:46:50 -070050int dquot_free_space(struct inode *inode, qsize_t number);
Jan Kara12095462008-08-20 14:45:12 +020051int dquot_free_inode(const struct inode *inode, qsize_t number);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
Jan Karab85f4b82008-07-25 01:46:50 -070053int dquot_transfer(struct inode *inode, struct iattr *iattr);
54int dquot_commit(struct dquot *dquot);
55int dquot_acquire(struct dquot *dquot);
56int dquot_release(struct dquot *dquot);
57int dquot_commit_info(struct super_block *sb, int type);
58int dquot_mark_dquot_dirty(struct dquot *dquot);
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
Jan Karab85f4b82008-07-25 01:46:50 -070060int vfs_quota_on(struct super_block *sb, int type, int format_id,
61 char *path, int remount);
Jan Karaf55abc02008-08-20 17:50:32 +020062int vfs_quota_enable(struct inode *inode, int type, int format_id,
63 unsigned int flags);
Al Viro77e69da2008-08-01 04:29:18 -040064int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
65 struct path *path);
Jan Karab85f4b82008-07-25 01:46:50 -070066int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
67 int format_id, int type);
68int vfs_quota_off(struct super_block *sb, int type, int remount);
Jan Karaf55abc02008-08-20 17:50:32 +020069int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags);
Jan Karab85f4b82008-07-25 01:46:50 -070070int vfs_quota_sync(struct super_block *sb, int type);
71int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
72int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
73int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
74int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
75
76void vfs_dq_drop(struct inode *inode);
77int vfs_dq_transfer(struct inode *inode, struct iattr *iattr);
78int vfs_dq_quota_on_remount(struct super_block *sb);
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
Jan Kara03b06342008-07-25 01:46:52 -070080static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
81{
82 return sb_dqopt(sb)->info + type;
83}
Jan Kara74abb982008-07-25 01:46:51 -070084
85/*
86 * Functions for checking status of quota
87 */
88
Jan Karaf55abc02008-08-20 17:50:32 +020089static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
Jan Kara03b06342008-07-25 01:46:52 -070090{
Jan Karaf55abc02008-08-20 17:50:32 +020091 return sb_dqopt(sb)->flags &
92 dquot_state_flag(DQUOT_USAGE_ENABLED, type);
Jan Kara03b06342008-07-25 01:46:52 -070093}
Jan Kara74abb982008-07-25 01:46:51 -070094
Jan Karaf55abc02008-08-20 17:50:32 +020095static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
Jan Kara03b06342008-07-25 01:46:52 -070096{
Jan Karaf55abc02008-08-20 17:50:32 +020097 return sb_dqopt(sb)->flags &
98 dquot_state_flag(DQUOT_LIMITS_ENABLED, type);
Jan Kara03b06342008-07-25 01:46:52 -070099}
Jan Kara74abb982008-07-25 01:46:51 -0700100
Jan Kara03b06342008-07-25 01:46:52 -0700101static inline int sb_has_quota_suspended(struct super_block *sb, int type)
102{
Jan Karaf55abc02008-08-20 17:50:32 +0200103 return sb_dqopt(sb)->flags &
104 dquot_state_flag(DQUOT_SUSPENDED, type);
Jan Kara03b06342008-07-25 01:46:52 -0700105}
Jan Kara74abb982008-07-25 01:46:51 -0700106
Jan Kara03b06342008-07-25 01:46:52 -0700107static inline int sb_any_quota_suspended(struct super_block *sb)
108{
109 return sb_has_quota_suspended(sb, USRQUOTA) ||
110 sb_has_quota_suspended(sb, GRPQUOTA);
111}
Jan Kara74abb982008-07-25 01:46:51 -0700112
Jan Karaf55abc02008-08-20 17:50:32 +0200113/* Does kernel know about any quota information for given sb + type? */
114static inline int sb_has_quota_loaded(struct super_block *sb, int type)
115{
116 /* Currently if anything is on, then quota usage is on as well */
117 return sb_has_quota_usage_enabled(sb, type);
118}
119
120static inline int sb_any_quota_loaded(struct super_block *sb)
121{
122 return sb_has_quota_loaded(sb, USRQUOTA) ||
123 sb_has_quota_loaded(sb, GRPQUOTA);
124}
125
126static inline int sb_has_quota_active(struct super_block *sb, int type)
127{
128 return sb_has_quota_loaded(sb, type) &&
129 !sb_has_quota_suspended(sb, type);
130}
131
132static inline int sb_any_quota_active(struct super_block *sb)
133{
134 return sb_has_quota_active(sb, USRQUOTA) ||
135 sb_has_quota_active(sb, GRPQUOTA);
136}
137
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138/*
139 * Operations supported for diskquotas.
140 */
Alexey Dobriyan61e225d2009-09-21 17:01:08 -0700141extern const struct dquot_operations dquot_operations;
Alexey Dobriyan0d54b212009-09-21 17:01:09 -0700142extern const struct quotactl_ops vfs_quotactl_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143
144#define sb_dquot_ops (&dquot_operations)
145#define sb_quotactl_ops (&vfs_quotactl_ops)
146
147/* It is better to call this function outside of any transaction as it might
148 * need a lot of space in journal for dquot structure allocation. */
Jan Karab85f4b82008-07-25 01:46:50 -0700149static inline void vfs_dq_init(struct inode *inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150{
151 BUG_ON(!inode->i_sb);
Jan Karaf55abc02008-08-20 17:50:32 +0200152 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153 inode->i_sb->dq_op->initialize(inode, -1);
154}
155
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156/* The following allocation/freeing/transfer functions *must* be called inside
157 * a transaction (deadlocks possible otherwise) */
Jan Karab85f4b82008-07-25 01:46:50 -0700158static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159{
Jan Karaf55abc02008-08-20 17:50:32 +0200160 if (sb_any_quota_active(inode->i_sb)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161 /* Used space is updated in alloc_space() */
162 if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA)
163 return 1;
164 }
165 else
166 inode_add_bytes(inode, nr);
167 return 0;
168}
169
Jan Karab85f4b82008-07-25 01:46:50 -0700170static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171{
172 int ret;
Jan Karab85f4b82008-07-25 01:46:50 -0700173 if (!(ret = vfs_dq_prealloc_space_nodirty(inode, nr)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174 mark_inode_dirty(inode);
175 return ret;
176}
177
Jan Karab85f4b82008-07-25 01:46:50 -0700178static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179{
Jan Karaf55abc02008-08-20 17:50:32 +0200180 if (sb_any_quota_active(inode->i_sb)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 /* Used space is updated in alloc_space() */
182 if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA)
183 return 1;
184 }
185 else
186 inode_add_bytes(inode, nr);
187 return 0;
188}
189
Jan Karab85f4b82008-07-25 01:46:50 -0700190static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191{
192 int ret;
Jan Karab85f4b82008-07-25 01:46:50 -0700193 if (!(ret = vfs_dq_alloc_space_nodirty(inode, nr)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194 mark_inode_dirty(inode);
195 return ret;
196}
197
Mingming Caof18df222009-01-13 16:43:09 +0100198static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
199{
200 if (sb_any_quota_active(inode->i_sb)) {
201 /* Used space is updated in alloc_space() */
202 if (inode->i_sb->dq_op->reserve_space(inode, nr, 0) == NO_QUOTA)
203 return 1;
204 }
Dmitry Monakhovc4690702010-02-09 17:53:36 +0100205 else
206 inode_add_rsv_space(inode, nr);
Mingming Caof18df222009-01-13 16:43:09 +0100207 return 0;
208}
209
Jan Karab85f4b82008-07-25 01:46:50 -0700210static inline int vfs_dq_alloc_inode(struct inode *inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211{
Jan Karaf55abc02008-08-20 17:50:32 +0200212 if (sb_any_quota_active(inode->i_sb)) {
Jan Karab85f4b82008-07-25 01:46:50 -0700213 vfs_dq_init(inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
215 return 1;
216 }
217 return 0;
218}
219
Mingming Cao740d9dc2009-01-13 16:43:14 +0100220/*
221 * Convert in-memory reserved quotas to real consumed quotas
222 */
223static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
224{
225 if (sb_any_quota_active(inode->i_sb)) {
226 if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA)
227 return 1;
228 } else
Dmitry Monakhovc4690702010-02-09 17:53:36 +0100229 inode_claim_rsv_space(inode, nr);
Mingming Cao740d9dc2009-01-13 16:43:14 +0100230
231 mark_inode_dirty(inode);
232 return 0;
233}
234
235/*
236 * Release reserved (in-memory) quotas
237 */
238static inline
239void vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
240{
241 if (sb_any_quota_active(inode->i_sb))
242 inode->i_sb->dq_op->release_rsv(inode, nr);
Dmitry Monakhovc4690702010-02-09 17:53:36 +0100243 else
244 inode_sub_rsv_space(inode, nr);
Mingming Cao740d9dc2009-01-13 16:43:14 +0100245}
246
Jan Karab85f4b82008-07-25 01:46:50 -0700247static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248{
Jan Karaf55abc02008-08-20 17:50:32 +0200249 if (sb_any_quota_active(inode->i_sb))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250 inode->i_sb->dq_op->free_space(inode, nr);
251 else
252 inode_sub_bytes(inode, nr);
253}
254
Jan Karab85f4b82008-07-25 01:46:50 -0700255static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256{
Jan Karab85f4b82008-07-25 01:46:50 -0700257 vfs_dq_free_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258 mark_inode_dirty(inode);
259}
260
Jan Karab85f4b82008-07-25 01:46:50 -0700261static inline void vfs_dq_free_inode(struct inode *inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262{
Jan Karaf55abc02008-08-20 17:50:32 +0200263 if (sb_any_quota_active(inode->i_sb))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 inode->i_sb->dq_op->free_inode(inode, 1);
265}
266
Christoph Hellwig850b2012009-04-27 16:43:54 +0200267/* Cannot be called inside a transaction */
Jan Karab85f4b82008-07-25 01:46:50 -0700268static inline int vfs_dq_off(struct super_block *sb, int remount)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269{
270 int ret = -ENOSYS;
271
Jan Kara0ff5af82008-04-28 02:14:33 -0700272 if (sb->s_qcop && sb->s_qcop->quota_off)
273 ret = sb->s_qcop->quota_off(sb, -1, remount);
274 return ret;
275}
276
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277#else
278
Jan Karaf55abc02008-08-20 17:50:32 +0200279static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
Jan Kara03b06342008-07-25 01:46:52 -0700280{
281 return 0;
282}
283
Jan Karaf55abc02008-08-20 17:50:32 +0200284static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
Jan Kara03b06342008-07-25 01:46:52 -0700285{
286 return 0;
287}
288
289static inline int sb_has_quota_suspended(struct super_block *sb, int type)
290{
291 return 0;
292}
293
294static inline int sb_any_quota_suspended(struct super_block *sb)
295{
296 return 0;
297}
Jan Kara74abb982008-07-25 01:46:51 -0700298
Jan Karaf55abc02008-08-20 17:50:32 +0200299/* Does kernel know about any quota information for given sb + type? */
300static inline int sb_has_quota_loaded(struct super_block *sb, int type)
301{
302 return 0;
303}
304
305static inline int sb_any_quota_loaded(struct super_block *sb)
306{
307 return 0;
308}
309
310static inline int sb_has_quota_active(struct super_block *sb, int type)
311{
312 return 0;
313}
314
315static inline int sb_any_quota_active(struct super_block *sb)
316{
317 return 0;
318}
319
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320/*
321 * NO-OP when quota not configured.
322 */
323#define sb_dquot_ops (NULL)
324#define sb_quotactl_ops (NULL)
Andrew Morton50f8c372008-04-28 02:14:35 -0700325
Jan Karab85f4b82008-07-25 01:46:50 -0700326static inline void vfs_dq_init(struct inode *inode)
Andrew Morton50f8c372008-04-28 02:14:35 -0700327{
328}
329
Jan Karab85f4b82008-07-25 01:46:50 -0700330static inline void vfs_dq_drop(struct inode *inode)
Andrew Morton50f8c372008-04-28 02:14:35 -0700331{
332}
333
Jan Karab85f4b82008-07-25 01:46:50 -0700334static inline int vfs_dq_alloc_inode(struct inode *inode)
Andrew Morton50f8c372008-04-28 02:14:35 -0700335{
336 return 0;
337}
338
Jan Karab85f4b82008-07-25 01:46:50 -0700339static inline void vfs_dq_free_inode(struct inode *inode)
Andrew Morton50f8c372008-04-28 02:14:35 -0700340{
341}
342
Christoph Hellwig850b2012009-04-27 16:43:54 +0200343static inline void sync_quota_sb(struct super_block *sb, int type)
Andrew Morton50f8c372008-04-28 02:14:35 -0700344{
345}
346
Jan Karac3f8a402009-04-27 16:43:55 +0200347static inline void writeout_quota_sb(struct super_block *sb, int type)
348{
349}
350
Jan Karab85f4b82008-07-25 01:46:50 -0700351static inline int vfs_dq_off(struct super_block *sb, int remount)
Andrew Morton50f8c372008-04-28 02:14:35 -0700352{
353 return 0;
354}
355
Jan Karab85f4b82008-07-25 01:46:50 -0700356static inline int vfs_dq_quota_on_remount(struct super_block *sb)
Andrew Morton50f8c372008-04-28 02:14:35 -0700357{
358 return 0;
359}
360
Jan Karab85f4b82008-07-25 01:46:50 -0700361static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr)
Andrew Morton50f8c372008-04-28 02:14:35 -0700362{
363 return 0;
364}
365
Jan Karab85f4b82008-07-25 01:46:50 -0700366static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367{
368 inode_add_bytes(inode, nr);
369 return 0;
370}
371
Jan Karab85f4b82008-07-25 01:46:50 -0700372static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373{
Jan Karab85f4b82008-07-25 01:46:50 -0700374 vfs_dq_prealloc_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375 mark_inode_dirty(inode);
376 return 0;
377}
378
Jan Karab85f4b82008-07-25 01:46:50 -0700379static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380{
381 inode_add_bytes(inode, nr);
382 return 0;
383}
384
Jan Karab85f4b82008-07-25 01:46:50 -0700385static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386{
Jan Karab85f4b82008-07-25 01:46:50 -0700387 vfs_dq_alloc_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388 mark_inode_dirty(inode);
389 return 0;
390}
391
Mingming Caof18df222009-01-13 16:43:09 +0100392static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
393{
394 return 0;
395}
396
Mingming Cao740d9dc2009-01-13 16:43:14 +0100397static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
398{
399 return vfs_dq_alloc_space(inode, nr);
400}
401
402static inline
403int vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
404{
405 return 0;
406}
407
Jan Karab85f4b82008-07-25 01:46:50 -0700408static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409{
410 inode_sub_bytes(inode, nr);
411}
412
Jan Karab85f4b82008-07-25 01:46:50 -0700413static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414{
Jan Karab85f4b82008-07-25 01:46:50 -0700415 vfs_dq_free_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416 mark_inode_dirty(inode);
417}
418
419#endif /* CONFIG_QUOTA */
420
Jan Karab85f4b82008-07-25 01:46:50 -0700421static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700422{
Mingming Cao9900ba32009-01-14 16:18:57 +0100423 return vfs_dq_prealloc_space_nodirty(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700424}
425
Jan Karab85f4b82008-07-25 01:46:50 -0700426static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700427{
Mingming Cao9900ba32009-01-14 16:18:57 +0100428 return vfs_dq_prealloc_space(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700429}
430
Jan Karab85f4b82008-07-25 01:46:50 -0700431static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700432{
Mingming Cao9900ba32009-01-14 16:18:57 +0100433 return vfs_dq_alloc_space_nodirty(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700434}
435
Jan Karab85f4b82008-07-25 01:46:50 -0700436static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700437{
Mingming Cao9900ba32009-01-14 16:18:57 +0100438 return vfs_dq_alloc_space(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700439}
440
Mingming Caof18df222009-01-13 16:43:09 +0100441static inline int vfs_dq_reserve_block(struct inode *inode, qsize_t nr)
442{
Mingming Cao9900ba32009-01-14 16:18:57 +0100443 return vfs_dq_reserve_space(inode, nr << inode->i_blkbits);
Mingming Caof18df222009-01-13 16:43:09 +0100444}
445
Mingming Cao740d9dc2009-01-13 16:43:14 +0100446static inline int vfs_dq_claim_block(struct inode *inode, qsize_t nr)
447{
Mingming Cao9900ba32009-01-14 16:18:57 +0100448 return vfs_dq_claim_space(inode, nr << inode->i_blkbits);
Mingming Cao740d9dc2009-01-13 16:43:14 +0100449}
450
451static inline
452void vfs_dq_release_reservation_block(struct inode *inode, qsize_t nr)
453{
454 vfs_dq_release_reservation_space(inode, nr << inode->i_blkbits);
455}
456
Jan Karab85f4b82008-07-25 01:46:50 -0700457static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700458{
Mingming Cao9900ba32009-01-14 16:18:57 +0100459 vfs_dq_free_space_nodirty(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700460}
461
Jan Karab85f4b82008-07-25 01:46:50 -0700462static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700463{
Mingming Cao9900ba32009-01-14 16:18:57 +0100464 vfs_dq_free_space(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700465}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700466
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467#endif /* _LINUX_QUOTAOPS_ */