blob: 8cfd0d44c99484d19c8c8d6129bd7b44f210df0f [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 */
Dmitry Monakhovc4690702010-02-09 17:53:36 +010022void inode_add_rsv_space(struct inode *inode, qsize_t number);
23void inode_claim_rsv_space(struct inode *inode, qsize_t number);
24void inode_sub_rsv_space(struct inode *inode, qsize_t number);
25
Jan Karab85f4b82008-07-25 01:46:50 -070026int dquot_initialize(struct inode *inode, int type);
27int dquot_drop(struct inode *inode);
Jan Kara3d9ea252008-10-10 16:12:23 +020028struct dquot *dqget(struct super_block *sb, unsigned int id, int type);
29void dqput(struct dquot *dquot);
Jan Kara12c77522008-10-20 17:05:00 +020030int dquot_scan_active(struct super_block *sb,
31 int (*fn)(struct dquot *dquot, unsigned long priv),
32 unsigned long priv);
Jan Kara7d9056b2008-11-25 15:31:32 +010033struct dquot *dquot_alloc(struct super_block *sb, int type);
34void dquot_destroy(struct dquot *dquot);
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
Jan Karab85f4b82008-07-25 01:46:50 -070036int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc);
Jan Kara12095462008-08-20 14:45:12 +020037int dquot_alloc_inode(const struct inode *inode, qsize_t number);
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
Mingming Cao740d9dc2009-01-13 16:43:14 +010039int dquot_reserve_space(struct inode *inode, qsize_t number, int prealloc);
40int dquot_claim_space(struct inode *inode, qsize_t number);
41void dquot_release_reserved_space(struct inode *inode, qsize_t number);
Mingming Cao740d9dc2009-01-13 16:43:14 +010042
Jan Karab85f4b82008-07-25 01:46:50 -070043int dquot_free_space(struct inode *inode, qsize_t number);
Jan Kara12095462008-08-20 14:45:12 +020044int dquot_free_inode(const struct inode *inode, qsize_t number);
Linus Torvalds1da177e2005-04-16 15:20:36 -070045
Jan Karab85f4b82008-07-25 01:46:50 -070046int dquot_transfer(struct inode *inode, struct iattr *iattr);
47int dquot_commit(struct dquot *dquot);
48int dquot_acquire(struct dquot *dquot);
49int dquot_release(struct dquot *dquot);
50int dquot_commit_info(struct super_block *sb, int type);
51int dquot_mark_dquot_dirty(struct dquot *dquot);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
Jan Karab85f4b82008-07-25 01:46:50 -070053int vfs_quota_on(struct super_block *sb, int type, int format_id,
54 char *path, int remount);
Jan Karaf55abc02008-08-20 17:50:32 +020055int vfs_quota_enable(struct inode *inode, int type, int format_id,
56 unsigned int flags);
Al Viro77e69da2008-08-01 04:29:18 -040057int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
58 struct path *path);
Jan Karab85f4b82008-07-25 01:46:50 -070059int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
60 int format_id, int type);
61int vfs_quota_off(struct super_block *sb, int type, int remount);
Jan Karaf55abc02008-08-20 17:50:32 +020062int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags);
Christoph Hellwig5fb324a2010-02-16 03:44:52 -050063int vfs_quota_sync(struct super_block *sb, int type, int wait);
Jan Karab85f4b82008-07-25 01:46:50 -070064int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
65int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
66int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
67int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
68
69void vfs_dq_drop(struct inode *inode);
70int vfs_dq_transfer(struct inode *inode, struct iattr *iattr);
71int vfs_dq_quota_on_remount(struct super_block *sb);
Linus Torvalds1da177e2005-04-16 15:20:36 -070072
Jan Kara03b06342008-07-25 01:46:52 -070073static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
74{
75 return sb_dqopt(sb)->info + type;
76}
Jan Kara74abb982008-07-25 01:46:51 -070077
78/*
79 * Functions for checking status of quota
80 */
81
Jan Karaf55abc02008-08-20 17:50:32 +020082static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
Jan Kara03b06342008-07-25 01:46:52 -070083{
Jan Karaf55abc02008-08-20 17:50:32 +020084 return sb_dqopt(sb)->flags &
85 dquot_state_flag(DQUOT_USAGE_ENABLED, type);
Jan Kara03b06342008-07-25 01:46:52 -070086}
Jan Kara74abb982008-07-25 01:46:51 -070087
Jan Karaf55abc02008-08-20 17:50:32 +020088static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
Jan Kara03b06342008-07-25 01:46:52 -070089{
Jan Karaf55abc02008-08-20 17:50:32 +020090 return sb_dqopt(sb)->flags &
91 dquot_state_flag(DQUOT_LIMITS_ENABLED, type);
Jan Kara03b06342008-07-25 01:46:52 -070092}
Jan Kara74abb982008-07-25 01:46:51 -070093
Jan Kara03b06342008-07-25 01:46:52 -070094static inline int sb_has_quota_suspended(struct super_block *sb, int type)
95{
Jan Karaf55abc02008-08-20 17:50:32 +020096 return sb_dqopt(sb)->flags &
97 dquot_state_flag(DQUOT_SUSPENDED, type);
Jan Kara03b06342008-07-25 01:46:52 -070098}
Jan Kara74abb982008-07-25 01:46:51 -070099
Jan Kara03b06342008-07-25 01:46:52 -0700100static inline int sb_any_quota_suspended(struct super_block *sb)
101{
102 return sb_has_quota_suspended(sb, USRQUOTA) ||
103 sb_has_quota_suspended(sb, GRPQUOTA);
104}
Jan Kara74abb982008-07-25 01:46:51 -0700105
Jan Karaf55abc02008-08-20 17:50:32 +0200106/* Does kernel know about any quota information for given sb + type? */
107static inline int sb_has_quota_loaded(struct super_block *sb, int type)
108{
109 /* Currently if anything is on, then quota usage is on as well */
110 return sb_has_quota_usage_enabled(sb, type);
111}
112
113static inline int sb_any_quota_loaded(struct super_block *sb)
114{
115 return sb_has_quota_loaded(sb, USRQUOTA) ||
116 sb_has_quota_loaded(sb, GRPQUOTA);
117}
118
119static inline int sb_has_quota_active(struct super_block *sb, int type)
120{
121 return sb_has_quota_loaded(sb, type) &&
122 !sb_has_quota_suspended(sb, type);
123}
124
125static inline int sb_any_quota_active(struct super_block *sb)
126{
127 return sb_has_quota_active(sb, USRQUOTA) ||
128 sb_has_quota_active(sb, GRPQUOTA);
129}
130
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131/*
132 * Operations supported for diskquotas.
133 */
Alexey Dobriyan61e225d2009-09-21 17:01:08 -0700134extern const struct dquot_operations dquot_operations;
Alexey Dobriyan0d54b212009-09-21 17:01:09 -0700135extern const struct quotactl_ops vfs_quotactl_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136
137#define sb_dquot_ops (&dquot_operations)
138#define sb_quotactl_ops (&vfs_quotactl_ops)
139
140/* It is better to call this function outside of any transaction as it might
141 * need a lot of space in journal for dquot structure allocation. */
Jan Karab85f4b82008-07-25 01:46:50 -0700142static inline void vfs_dq_init(struct inode *inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143{
144 BUG_ON(!inode->i_sb);
Jan Karaf55abc02008-08-20 17:50:32 +0200145 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146 inode->i_sb->dq_op->initialize(inode, -1);
147}
148
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149/* The following allocation/freeing/transfer functions *must* be called inside
150 * a transaction (deadlocks possible otherwise) */
Jan Karab85f4b82008-07-25 01:46:50 -0700151static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152{
Jan Karaf55abc02008-08-20 17:50:32 +0200153 if (sb_any_quota_active(inode->i_sb)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 /* Used space is updated in alloc_space() */
155 if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA)
156 return 1;
157 }
158 else
159 inode_add_bytes(inode, nr);
160 return 0;
161}
162
Jan Karab85f4b82008-07-25 01:46:50 -0700163static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164{
165 int ret;
Jan Karab85f4b82008-07-25 01:46:50 -0700166 if (!(ret = vfs_dq_prealloc_space_nodirty(inode, nr)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 mark_inode_dirty(inode);
168 return ret;
169}
170
Jan Karab85f4b82008-07-25 01:46:50 -0700171static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172{
Jan Karaf55abc02008-08-20 17:50:32 +0200173 if (sb_any_quota_active(inode->i_sb)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174 /* Used space is updated in alloc_space() */
175 if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA)
176 return 1;
177 }
178 else
179 inode_add_bytes(inode, nr);
180 return 0;
181}
182
Jan Karab85f4b82008-07-25 01:46:50 -0700183static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184{
185 int ret;
Jan Karab85f4b82008-07-25 01:46:50 -0700186 if (!(ret = vfs_dq_alloc_space_nodirty(inode, nr)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187 mark_inode_dirty(inode);
188 return ret;
189}
190
Mingming Caof18df222009-01-13 16:43:09 +0100191static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
192{
193 if (sb_any_quota_active(inode->i_sb)) {
194 /* Used space is updated in alloc_space() */
195 if (inode->i_sb->dq_op->reserve_space(inode, nr, 0) == NO_QUOTA)
196 return 1;
197 }
Dmitry Monakhovc4690702010-02-09 17:53:36 +0100198 else
199 inode_add_rsv_space(inode, nr);
Mingming Caof18df222009-01-13 16:43:09 +0100200 return 0;
201}
202
Jan Karab85f4b82008-07-25 01:46:50 -0700203static inline int vfs_dq_alloc_inode(struct inode *inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204{
Jan Karaf55abc02008-08-20 17:50:32 +0200205 if (sb_any_quota_active(inode->i_sb)) {
Jan Karab85f4b82008-07-25 01:46:50 -0700206 vfs_dq_init(inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
208 return 1;
209 }
210 return 0;
211}
212
Mingming Cao740d9dc2009-01-13 16:43:14 +0100213/*
214 * Convert in-memory reserved quotas to real consumed quotas
215 */
216static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
217{
218 if (sb_any_quota_active(inode->i_sb)) {
219 if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA)
220 return 1;
221 } else
Dmitry Monakhovc4690702010-02-09 17:53:36 +0100222 inode_claim_rsv_space(inode, nr);
Mingming Cao740d9dc2009-01-13 16:43:14 +0100223
224 mark_inode_dirty(inode);
225 return 0;
226}
227
228/*
229 * Release reserved (in-memory) quotas
230 */
231static inline
232void vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
233{
234 if (sb_any_quota_active(inode->i_sb))
235 inode->i_sb->dq_op->release_rsv(inode, nr);
Dmitry Monakhovc4690702010-02-09 17:53:36 +0100236 else
237 inode_sub_rsv_space(inode, nr);
Mingming Cao740d9dc2009-01-13 16:43:14 +0100238}
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
Jan Karab85f4b82008-07-25 01:46:50 -0700336static inline int vfs_dq_off(struct super_block *sb, int remount)
Andrew Morton50f8c372008-04-28 02:14:35 -0700337{
338 return 0;
339}
340
Jan Karab85f4b82008-07-25 01:46:50 -0700341static inline int vfs_dq_quota_on_remount(struct super_block *sb)
Andrew Morton50f8c372008-04-28 02:14:35 -0700342{
343 return 0;
344}
345
Jan Karab85f4b82008-07-25 01:46:50 -0700346static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr)
Andrew Morton50f8c372008-04-28 02:14:35 -0700347{
348 return 0;
349}
350
Jan Karab85f4b82008-07-25 01:46:50 -0700351static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352{
353 inode_add_bytes(inode, nr);
354 return 0;
355}
356
Jan Karab85f4b82008-07-25 01:46:50 -0700357static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358{
Jan Karab85f4b82008-07-25 01:46:50 -0700359 vfs_dq_prealloc_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360 mark_inode_dirty(inode);
361 return 0;
362}
363
Jan Karab85f4b82008-07-25 01:46:50 -0700364static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365{
366 inode_add_bytes(inode, nr);
367 return 0;
368}
369
Jan Karab85f4b82008-07-25 01:46:50 -0700370static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371{
Jan Karab85f4b82008-07-25 01:46:50 -0700372 vfs_dq_alloc_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373 mark_inode_dirty(inode);
374 return 0;
375}
376
Mingming Caof18df222009-01-13 16:43:09 +0100377static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
378{
379 return 0;
380}
381
Mingming Cao740d9dc2009-01-13 16:43:14 +0100382static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
383{
384 return vfs_dq_alloc_space(inode, nr);
385}
386
387static inline
388int vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
389{
390 return 0;
391}
392
Jan Karab85f4b82008-07-25 01:46:50 -0700393static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700394{
395 inode_sub_bytes(inode, nr);
396}
397
Jan Karab85f4b82008-07-25 01:46:50 -0700398static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399{
Jan Karab85f4b82008-07-25 01:46:50 -0700400 vfs_dq_free_space_nodirty(inode, nr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401 mark_inode_dirty(inode);
402}
403
404#endif /* CONFIG_QUOTA */
405
Jan Karab85f4b82008-07-25 01:46:50 -0700406static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700407{
Mingming Cao9900ba32009-01-14 16:18:57 +0100408 return vfs_dq_prealloc_space_nodirty(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700409}
410
Jan Karab85f4b82008-07-25 01:46:50 -0700411static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700412{
Mingming Cao9900ba32009-01-14 16:18:57 +0100413 return vfs_dq_prealloc_space(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700414}
415
Jan Karab85f4b82008-07-25 01:46:50 -0700416static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700417{
Mingming Cao9900ba32009-01-14 16:18:57 +0100418 return vfs_dq_alloc_space_nodirty(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700419}
420
Jan Karab85f4b82008-07-25 01:46:50 -0700421static inline int vfs_dq_alloc_block(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_alloc_space(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700424}
425
Mingming Caof18df222009-01-13 16:43:09 +0100426static inline int vfs_dq_reserve_block(struct inode *inode, qsize_t nr)
427{
Mingming Cao9900ba32009-01-14 16:18:57 +0100428 return vfs_dq_reserve_space(inode, nr << inode->i_blkbits);
Mingming Caof18df222009-01-13 16:43:09 +0100429}
430
Mingming Cao740d9dc2009-01-13 16:43:14 +0100431static inline int vfs_dq_claim_block(struct inode *inode, qsize_t nr)
432{
Mingming Cao9900ba32009-01-14 16:18:57 +0100433 return vfs_dq_claim_space(inode, nr << inode->i_blkbits);
Mingming Cao740d9dc2009-01-13 16:43:14 +0100434}
435
436static inline
437void vfs_dq_release_reservation_block(struct inode *inode, qsize_t nr)
438{
439 vfs_dq_release_reservation_space(inode, nr << inode->i_blkbits);
440}
441
Jan Karab85f4b82008-07-25 01:46:50 -0700442static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700443{
Mingming Cao9900ba32009-01-14 16:18:57 +0100444 vfs_dq_free_space_nodirty(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700445}
446
Jan Karab85f4b82008-07-25 01:46:50 -0700447static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr)
Jan Kara03f6e922008-04-28 02:14:32 -0700448{
Mingming Cao9900ba32009-01-14 16:18:57 +0100449 vfs_dq_free_space(inode, nr << inode->i_blkbits);
Jan Kara03f6e922008-04-28 02:14:32 -0700450}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452#endif /* _LINUX_QUOTAOPS_ */