diff options
Diffstat (limited to 'include/linux/quotaops.h')
-rw-r--r-- | include/linux/quotaops.h | 304 |
1 files changed, 92 insertions, 212 deletions
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 3ebb23153640..e6fa7acce290 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -19,15 +19,12 @@ static inline struct quota_info *sb_dqopt(struct super_block *sb) | |||
19 | /* | 19 | /* |
20 | * declaration of quota_function calls in kernel. | 20 | * declaration of quota_function calls in kernel. |
21 | */ | 21 | */ |
22 | void sync_quota_sb(struct super_block *sb, int type); | 22 | void inode_add_rsv_space(struct inode *inode, qsize_t number); |
23 | static inline void writeout_quota_sb(struct super_block *sb, int type) | 23 | void inode_claim_rsv_space(struct inode *inode, qsize_t number); |
24 | { | 24 | void inode_sub_rsv_space(struct inode *inode, qsize_t number); |
25 | if (sb->s_qcop->quota_sync) | ||
26 | sb->s_qcop->quota_sync(sb, type); | ||
27 | } | ||
28 | 25 | ||
29 | int dquot_initialize(struct inode *inode, int type); | 26 | void dquot_initialize(struct inode *inode); |
30 | int dquot_drop(struct inode *inode); | 27 | void dquot_drop(struct inode *inode); |
31 | struct dquot *dqget(struct super_block *sb, unsigned int id, int type); | 28 | struct dquot *dqget(struct super_block *sb, unsigned int id, int type); |
32 | void dqput(struct dquot *dquot); | 29 | void dqput(struct dquot *dquot); |
33 | int dquot_scan_active(struct super_block *sb, | 30 | int dquot_scan_active(struct super_block *sb, |
@@ -36,24 +33,23 @@ int dquot_scan_active(struct super_block *sb, | |||
36 | struct dquot *dquot_alloc(struct super_block *sb, int type); | 33 | struct dquot *dquot_alloc(struct super_block *sb, int type); |
37 | void dquot_destroy(struct dquot *dquot); | 34 | void dquot_destroy(struct dquot *dquot); |
38 | 35 | ||
39 | int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); | 36 | int __dquot_alloc_space(struct inode *inode, qsize_t number, |
40 | int dquot_alloc_inode(const struct inode *inode, qsize_t number); | 37 | int warn, int reserve); |
38 | void __dquot_free_space(struct inode *inode, qsize_t number, int reserve); | ||
41 | 39 | ||
42 | int dquot_reserve_space(struct inode *inode, qsize_t number, int prealloc); | 40 | int dquot_alloc_inode(const struct inode *inode); |
43 | int dquot_claim_space(struct inode *inode, qsize_t number); | ||
44 | void dquot_release_reserved_space(struct inode *inode, qsize_t number); | ||
45 | qsize_t dquot_get_reserved_space(struct inode *inode); | ||
46 | 41 | ||
47 | int dquot_free_space(struct inode *inode, qsize_t number); | 42 | int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); |
48 | int dquot_free_inode(const struct inode *inode, qsize_t number); | 43 | void dquot_free_inode(const struct inode *inode); |
49 | 44 | ||
50 | int dquot_transfer(struct inode *inode, struct iattr *iattr); | ||
51 | int dquot_commit(struct dquot *dquot); | 45 | int dquot_commit(struct dquot *dquot); |
52 | int dquot_acquire(struct dquot *dquot); | 46 | int dquot_acquire(struct dquot *dquot); |
53 | int dquot_release(struct dquot *dquot); | 47 | int dquot_release(struct dquot *dquot); |
54 | int dquot_commit_info(struct super_block *sb, int type); | 48 | int dquot_commit_info(struct super_block *sb, int type); |
55 | int dquot_mark_dquot_dirty(struct dquot *dquot); | 49 | int dquot_mark_dquot_dirty(struct dquot *dquot); |
56 | 50 | ||
51 | int dquot_file_open(struct inode *inode, struct file *file); | ||
52 | |||
57 | int vfs_quota_on(struct super_block *sb, int type, int format_id, | 53 | int vfs_quota_on(struct super_block *sb, int type, int format_id, |
58 | char *path, int remount); | 54 | char *path, int remount); |
59 | int vfs_quota_enable(struct inode *inode, int type, int format_id, | 55 | int vfs_quota_enable(struct inode *inode, int type, int format_id, |
@@ -64,14 +60,13 @@ int vfs_quota_on_mount(struct super_block *sb, char *qf_name, | |||
64 | int format_id, int type); | 60 | int format_id, int type); |
65 | int vfs_quota_off(struct super_block *sb, int type, int remount); | 61 | int vfs_quota_off(struct super_block *sb, int type, int remount); |
66 | int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags); | 62 | int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags); |
67 | int vfs_quota_sync(struct super_block *sb, int type); | 63 | int vfs_quota_sync(struct super_block *sb, int type, int wait); |
68 | int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); | 64 | int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
69 | int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); | 65 | int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); |
70 | int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); | 66 | int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); |
71 | int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); | 67 | int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); |
72 | 68 | ||
73 | void vfs_dq_drop(struct inode *inode); | 69 | int dquot_transfer(struct inode *inode, struct iattr *iattr); |
74 | int vfs_dq_transfer(struct inode *inode, struct iattr *iattr); | ||
75 | int vfs_dq_quota_on_remount(struct super_block *sb); | 70 | int vfs_dq_quota_on_remount(struct super_block *sb); |
76 | 71 | ||
77 | static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) | 72 | static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) |
@@ -83,53 +78,56 @@ static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) | |||
83 | * Functions for checking status of quota | 78 | * Functions for checking status of quota |
84 | */ | 79 | */ |
85 | 80 | ||
86 | static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type) | 81 | static inline bool sb_has_quota_usage_enabled(struct super_block *sb, int type) |
87 | { | 82 | { |
88 | return sb_dqopt(sb)->flags & | 83 | return sb_dqopt(sb)->flags & |
89 | dquot_state_flag(DQUOT_USAGE_ENABLED, type); | 84 | dquot_state_flag(DQUOT_USAGE_ENABLED, type); |
90 | } | 85 | } |
91 | 86 | ||
92 | static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type) | 87 | static inline bool sb_has_quota_limits_enabled(struct super_block *sb, int type) |
93 | { | 88 | { |
94 | return sb_dqopt(sb)->flags & | 89 | return sb_dqopt(sb)->flags & |
95 | dquot_state_flag(DQUOT_LIMITS_ENABLED, type); | 90 | dquot_state_flag(DQUOT_LIMITS_ENABLED, type); |
96 | } | 91 | } |
97 | 92 | ||
98 | static inline int sb_has_quota_suspended(struct super_block *sb, int type) | 93 | static inline bool sb_has_quota_suspended(struct super_block *sb, int type) |
99 | { | 94 | { |
100 | return sb_dqopt(sb)->flags & | 95 | return sb_dqopt(sb)->flags & |
101 | dquot_state_flag(DQUOT_SUSPENDED, type); | 96 | dquot_state_flag(DQUOT_SUSPENDED, type); |
102 | } | 97 | } |
103 | 98 | ||
104 | static inline int sb_any_quota_suspended(struct super_block *sb) | 99 | static inline unsigned sb_any_quota_suspended(struct super_block *sb) |
105 | { | 100 | { |
106 | return sb_has_quota_suspended(sb, USRQUOTA) || | 101 | unsigned type, tmsk = 0; |
107 | sb_has_quota_suspended(sb, GRPQUOTA); | 102 | for (type = 0; type < MAXQUOTAS; type++) |
103 | tmsk |= sb_has_quota_suspended(sb, type) << type; | ||
104 | return tmsk; | ||
108 | } | 105 | } |
109 | 106 | ||
110 | /* Does kernel know about any quota information for given sb + type? */ | 107 | /* Does kernel know about any quota information for given sb + type? */ |
111 | static inline int sb_has_quota_loaded(struct super_block *sb, int type) | 108 | static inline bool sb_has_quota_loaded(struct super_block *sb, int type) |
112 | { | 109 | { |
113 | /* Currently if anything is on, then quota usage is on as well */ | 110 | /* Currently if anything is on, then quota usage is on as well */ |
114 | return sb_has_quota_usage_enabled(sb, type); | 111 | return sb_has_quota_usage_enabled(sb, type); |
115 | } | 112 | } |
116 | 113 | ||
117 | static inline int sb_any_quota_loaded(struct super_block *sb) | 114 | static inline unsigned sb_any_quota_loaded(struct super_block *sb) |
118 | { | 115 | { |
119 | return sb_has_quota_loaded(sb, USRQUOTA) || | 116 | unsigned type, tmsk = 0; |
120 | sb_has_quota_loaded(sb, GRPQUOTA); | 117 | for (type = 0; type < MAXQUOTAS; type++) |
118 | tmsk |= sb_has_quota_loaded(sb, type) << type; | ||
119 | return tmsk; | ||
121 | } | 120 | } |
122 | 121 | ||
123 | static inline int sb_has_quota_active(struct super_block *sb, int type) | 122 | static inline bool sb_has_quota_active(struct super_block *sb, int type) |
124 | { | 123 | { |
125 | return sb_has_quota_loaded(sb, type) && | 124 | return sb_has_quota_loaded(sb, type) && |
126 | !sb_has_quota_suspended(sb, type); | 125 | !sb_has_quota_suspended(sb, type); |
127 | } | 126 | } |
128 | 127 | ||
129 | static inline int sb_any_quota_active(struct super_block *sb) | 128 | static inline unsigned sb_any_quota_active(struct super_block *sb) |
130 | { | 129 | { |
131 | return sb_has_quota_active(sb, USRQUOTA) || | 130 | return sb_any_quota_loaded(sb) & ~sb_any_quota_suspended(sb); |
132 | sb_has_quota_active(sb, GRPQUOTA); | ||
133 | } | 131 | } |
134 | 132 | ||
135 | /* | 133 | /* |
@@ -141,122 +139,6 @@ extern const struct quotactl_ops vfs_quotactl_ops; | |||
141 | #define sb_dquot_ops (&dquot_operations) | 139 | #define sb_dquot_ops (&dquot_operations) |
142 | #define sb_quotactl_ops (&vfs_quotactl_ops) | 140 | #define sb_quotactl_ops (&vfs_quotactl_ops) |
143 | 141 | ||
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. */ | ||
146 | static inline void vfs_dq_init(struct inode *inode) | ||
147 | { | ||
148 | BUG_ON(!inode->i_sb); | ||
149 | if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) | ||
150 | inode->i_sb->dq_op->initialize(inode, -1); | ||
151 | } | ||
152 | |||
153 | /* The following allocation/freeing/transfer functions *must* be called inside | ||
154 | * a transaction (deadlocks possible otherwise) */ | ||
155 | static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) | ||
156 | { | ||
157 | if (sb_any_quota_active(inode->i_sb)) { | ||
158 | /* 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 | |||
167 | static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr) | ||
168 | { | ||
169 | int ret; | ||
170 | if (!(ret = vfs_dq_prealloc_space_nodirty(inode, nr))) | ||
171 | mark_inode_dirty(inode); | ||
172 | return ret; | ||
173 | } | ||
174 | |||
175 | static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) | ||
176 | { | ||
177 | if (sb_any_quota_active(inode->i_sb)) { | ||
178 | /* 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 | |||
187 | static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) | ||
188 | { | ||
189 | int ret; | ||
190 | if (!(ret = vfs_dq_alloc_space_nodirty(inode, nr))) | ||
191 | mark_inode_dirty(inode); | ||
192 | return ret; | ||
193 | } | ||
194 | |||
195 | static 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 | |||
205 | static inline int vfs_dq_alloc_inode(struct inode *inode) | ||
206 | { | ||
207 | if (sb_any_quota_active(inode->i_sb)) { | ||
208 | vfs_dq_init(inode); | ||
209 | if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) | ||
210 | return 1; | ||
211 | } | ||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | /* | ||
216 | * Convert in-memory reserved quotas to real consumed quotas | ||
217 | */ | ||
218 | static 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 | */ | ||
233 | static inline | ||
234 | void 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 | |||
240 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) | ||
241 | { | ||
242 | if (sb_any_quota_active(inode->i_sb)) | ||
243 | inode->i_sb->dq_op->free_space(inode, nr); | ||
244 | else | ||
245 | inode_sub_bytes(inode, nr); | ||
246 | } | ||
247 | |||
248 | static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) | ||
249 | { | ||
250 | vfs_dq_free_space_nodirty(inode, nr); | ||
251 | mark_inode_dirty(inode); | ||
252 | } | ||
253 | |||
254 | static inline void vfs_dq_free_inode(struct inode *inode) | ||
255 | { | ||
256 | if (sb_any_quota_active(inode->i_sb)) | ||
257 | inode->i_sb->dq_op->free_inode(inode, 1); | ||
258 | } | ||
259 | |||
260 | /* Cannot be called inside a transaction */ | 142 | /* Cannot be called inside a transaction */ |
261 | static inline int vfs_dq_off(struct super_block *sb, int remount) | 143 | static inline int vfs_dq_off(struct super_block *sb, int remount) |
262 | { | 144 | { |
@@ -316,28 +198,20 @@ static inline int sb_any_quota_active(struct super_block *sb) | |||
316 | #define sb_dquot_ops (NULL) | 198 | #define sb_dquot_ops (NULL) |
317 | #define sb_quotactl_ops (NULL) | 199 | #define sb_quotactl_ops (NULL) |
318 | 200 | ||
319 | static inline void vfs_dq_init(struct inode *inode) | 201 | static inline void dquot_initialize(struct inode *inode) |
320 | { | 202 | { |
321 | } | 203 | } |
322 | 204 | ||
323 | static inline void vfs_dq_drop(struct inode *inode) | 205 | static inline void dquot_drop(struct inode *inode) |
324 | { | 206 | { |
325 | } | 207 | } |
326 | 208 | ||
327 | static inline int vfs_dq_alloc_inode(struct inode *inode) | 209 | static inline int dquot_alloc_inode(const struct inode *inode) |
328 | { | 210 | { |
329 | return 0; | 211 | return 0; |
330 | } | 212 | } |
331 | 213 | ||
332 | static inline void vfs_dq_free_inode(struct inode *inode) | 214 | static inline void dquot_free_inode(const struct inode *inode) |
333 | { | ||
334 | } | ||
335 | |||
336 | static inline void sync_quota_sb(struct super_block *sb, int type) | ||
337 | { | ||
338 | } | ||
339 | |||
340 | static inline void writeout_quota_sb(struct super_block *sb, int type) | ||
341 | { | 215 | { |
342 | } | 216 | } |
343 | 217 | ||
@@ -351,110 +225,116 @@ static inline int vfs_dq_quota_on_remount(struct super_block *sb) | |||
351 | return 0; | 225 | return 0; |
352 | } | 226 | } |
353 | 227 | ||
354 | static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) | 228 | static inline int dquot_transfer(struct inode *inode, struct iattr *iattr) |
355 | { | 229 | { |
356 | return 0; | 230 | return 0; |
357 | } | 231 | } |
358 | 232 | ||
359 | static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) | 233 | static inline int __dquot_alloc_space(struct inode *inode, qsize_t number, |
234 | int warn, int reserve) | ||
360 | { | 235 | { |
361 | inode_add_bytes(inode, nr); | 236 | if (!reserve) |
237 | inode_add_bytes(inode, number); | ||
362 | return 0; | 238 | return 0; |
363 | } | 239 | } |
364 | 240 | ||
365 | static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr) | 241 | static inline void __dquot_free_space(struct inode *inode, qsize_t number, |
242 | int reserve) | ||
366 | { | 243 | { |
367 | vfs_dq_prealloc_space_nodirty(inode, nr); | 244 | if (!reserve) |
368 | mark_inode_dirty(inode); | 245 | inode_sub_bytes(inode, number); |
369 | return 0; | ||
370 | } | 246 | } |
371 | 247 | ||
372 | static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) | 248 | static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) |
373 | { | 249 | { |
374 | inode_add_bytes(inode, nr); | 250 | inode_add_bytes(inode, number); |
375 | return 0; | 251 | return 0; |
376 | } | 252 | } |
377 | 253 | ||
378 | static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr) | 254 | #define dquot_file_open generic_file_open |
255 | |||
256 | #endif /* CONFIG_QUOTA */ | ||
257 | |||
258 | static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr) | ||
379 | { | 259 | { |
380 | vfs_dq_alloc_space_nodirty(inode, nr); | 260 | return __dquot_alloc_space(inode, nr, 1, 0); |
381 | mark_inode_dirty(inode); | ||
382 | return 0; | ||
383 | } | 261 | } |
384 | 262 | ||
385 | static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr) | 263 | static inline int dquot_alloc_space(struct inode *inode, qsize_t nr) |
386 | { | 264 | { |
387 | return 0; | 265 | int ret; |
266 | |||
267 | ret = dquot_alloc_space_nodirty(inode, nr); | ||
268 | if (!ret) | ||
269 | mark_inode_dirty(inode); | ||
270 | return ret; | ||
388 | } | 271 | } |
389 | 272 | ||
390 | static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr) | 273 | static inline int dquot_alloc_block_nodirty(struct inode *inode, qsize_t nr) |
391 | { | 274 | { |
392 | return vfs_dq_alloc_space(inode, nr); | 275 | return dquot_alloc_space_nodirty(inode, nr << inode->i_blkbits); |
393 | } | 276 | } |
394 | 277 | ||
395 | static inline | 278 | static inline int dquot_alloc_block(struct inode *inode, qsize_t nr) |
396 | int vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr) | ||
397 | { | 279 | { |
398 | return 0; | 280 | return dquot_alloc_space(inode, nr << inode->i_blkbits); |
399 | } | 281 | } |
400 | 282 | ||
401 | static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) | 283 | static inline int dquot_prealloc_block_nodirty(struct inode *inode, qsize_t nr) |
402 | { | 284 | { |
403 | inode_sub_bytes(inode, nr); | 285 | return __dquot_alloc_space(inode, nr << inode->i_blkbits, 0, 0); |
404 | } | 286 | } |
405 | 287 | ||
406 | static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr) | 288 | static inline int dquot_prealloc_block(struct inode *inode, qsize_t nr) |
407 | { | 289 | { |
408 | vfs_dq_free_space_nodirty(inode, nr); | 290 | int ret; |
409 | mark_inode_dirty(inode); | ||
410 | } | ||
411 | |||
412 | #endif /* CONFIG_QUOTA */ | ||
413 | 291 | ||
414 | static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr) | 292 | ret = dquot_prealloc_block_nodirty(inode, nr); |
415 | { | 293 | if (!ret) |
416 | return vfs_dq_prealloc_space_nodirty(inode, nr << inode->i_blkbits); | 294 | mark_inode_dirty(inode); |
295 | return ret; | ||
417 | } | 296 | } |
418 | 297 | ||
419 | static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr) | 298 | static inline int dquot_reserve_block(struct inode *inode, qsize_t nr) |
420 | { | 299 | { |
421 | return vfs_dq_prealloc_space(inode, nr << inode->i_blkbits); | 300 | return __dquot_alloc_space(inode, nr << inode->i_blkbits, 1, 1); |
422 | } | 301 | } |
423 | 302 | ||
424 | static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr) | 303 | static inline int dquot_claim_block(struct inode *inode, qsize_t nr) |
425 | { | 304 | { |
426 | return vfs_dq_alloc_space_nodirty(inode, nr << inode->i_blkbits); | 305 | int ret; |
427 | } | ||
428 | 306 | ||
429 | static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr) | 307 | ret = dquot_claim_space_nodirty(inode, nr << inode->i_blkbits); |
430 | { | 308 | if (!ret) |
431 | return vfs_dq_alloc_space(inode, nr << inode->i_blkbits); | 309 | mark_inode_dirty(inode); |
310 | return ret; | ||
432 | } | 311 | } |
433 | 312 | ||
434 | static inline int vfs_dq_reserve_block(struct inode *inode, qsize_t nr) | 313 | static inline void dquot_free_space_nodirty(struct inode *inode, qsize_t nr) |
435 | { | 314 | { |
436 | return vfs_dq_reserve_space(inode, nr << inode->i_blkbits); | 315 | __dquot_free_space(inode, nr, 0); |
437 | } | 316 | } |
438 | 317 | ||
439 | static inline int vfs_dq_claim_block(struct inode *inode, qsize_t nr) | 318 | static inline void dquot_free_space(struct inode *inode, qsize_t nr) |
440 | { | 319 | { |
441 | return vfs_dq_claim_space(inode, nr << inode->i_blkbits); | 320 | dquot_free_space_nodirty(inode, nr); |
321 | mark_inode_dirty(inode); | ||
442 | } | 322 | } |
443 | 323 | ||
444 | static inline | 324 | static inline void dquot_free_block_nodirty(struct inode *inode, qsize_t nr) |
445 | void vfs_dq_release_reservation_block(struct inode *inode, qsize_t nr) | ||
446 | { | 325 | { |
447 | vfs_dq_release_reservation_space(inode, nr << inode->i_blkbits); | 326 | dquot_free_space_nodirty(inode, nr << inode->i_blkbits); |
448 | } | 327 | } |
449 | 328 | ||
450 | static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr) | 329 | static inline void dquot_free_block(struct inode *inode, qsize_t nr) |
451 | { | 330 | { |
452 | vfs_dq_free_space_nodirty(inode, nr << inode->i_blkbits); | 331 | dquot_free_space(inode, nr << inode->i_blkbits); |
453 | } | 332 | } |
454 | 333 | ||
455 | static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr) | 334 | static inline void dquot_release_reservation_block(struct inode *inode, |
335 | qsize_t nr) | ||
456 | { | 336 | { |
457 | vfs_dq_free_space(inode, nr << inode->i_blkbits); | 337 | __dquot_free_space(inode, nr << inode->i_blkbits, 1); |
458 | } | 338 | } |
459 | 339 | ||
460 | #endif /* _LINUX_QUOTAOPS_ */ | 340 | #endif /* _LINUX_QUOTAOPS_ */ |