diff options
-rw-r--r-- | fs/quota/dquot.c | 3 | ||||
-rw-r--r-- | include/linux/quotaops.h | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 8c40c07797a..df6832ec17c 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -1494,6 +1494,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags) | |||
1494 | char warntype[MAXQUOTAS]; | 1494 | char warntype[MAXQUOTAS]; |
1495 | int warn = flags & DQUOT_SPACE_WARN; | 1495 | int warn = flags & DQUOT_SPACE_WARN; |
1496 | int reserve = flags & DQUOT_SPACE_RESERVE; | 1496 | int reserve = flags & DQUOT_SPACE_RESERVE; |
1497 | int nofail = flags & DQUOT_SPACE_NOFAIL; | ||
1497 | 1498 | ||
1498 | /* | 1499 | /* |
1499 | * First test before acquiring mutex - solves deadlocks when we | 1500 | * First test before acquiring mutex - solves deadlocks when we |
@@ -1514,7 +1515,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags) | |||
1514 | continue; | 1515 | continue; |
1515 | ret = check_bdq(inode->i_dquot[cnt], number, !warn, | 1516 | ret = check_bdq(inode->i_dquot[cnt], number, !warn, |
1516 | warntype+cnt); | 1517 | warntype+cnt); |
1517 | if (ret) { | 1518 | if (ret && !nofail) { |
1518 | spin_unlock(&dq_data_lock); | 1519 | spin_unlock(&dq_data_lock); |
1519 | goto out_flush_warn; | 1520 | goto out_flush_warn; |
1520 | } | 1521 | } |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 9edd53c2498..f8dbeb0fe0c 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #define DQUOT_SPACE_WARN 0x1 | 12 | #define DQUOT_SPACE_WARN 0x1 |
13 | #define DQUOT_SPACE_RESERVE 0x2 | 13 | #define DQUOT_SPACE_RESERVE 0x2 |
14 | #define DQUOT_SPACE_NOFAIL 0x4 | ||
14 | 15 | ||
15 | static inline struct quota_info *sb_dqopt(struct super_block *sb) | 16 | static inline struct quota_info *sb_dqopt(struct super_block *sb) |
16 | { | 17 | { |
@@ -262,6 +263,12 @@ static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr) | |||
262 | return __dquot_alloc_space(inode, nr, DQUOT_SPACE_WARN); | 263 | return __dquot_alloc_space(inode, nr, DQUOT_SPACE_WARN); |
263 | } | 264 | } |
264 | 265 | ||
266 | static inline void dquot_alloc_space_nofail(struct inode *inode, qsize_t nr) | ||
267 | { | ||
268 | __dquot_alloc_space(inode, nr, DQUOT_SPACE_WARN|DQUOT_SPACE_NOFAIL); | ||
269 | mark_inode_dirty(inode); | ||
270 | } | ||
271 | |||
265 | static inline int dquot_alloc_space(struct inode *inode, qsize_t nr) | 272 | static inline int dquot_alloc_space(struct inode *inode, qsize_t nr) |
266 | { | 273 | { |
267 | int ret; | 274 | int ret; |
@@ -277,6 +284,11 @@ static inline int dquot_alloc_block_nodirty(struct inode *inode, qsize_t nr) | |||
277 | return dquot_alloc_space_nodirty(inode, nr << inode->i_blkbits); | 284 | return dquot_alloc_space_nodirty(inode, nr << inode->i_blkbits); |
278 | } | 285 | } |
279 | 286 | ||
287 | static inline void dquot_alloc_block_nofail(struct inode *inode, qsize_t nr) | ||
288 | { | ||
289 | dquot_alloc_space_nofail(inode, nr << inode->i_blkbits); | ||
290 | } | ||
291 | |||
280 | static inline int dquot_alloc_block(struct inode *inode, qsize_t nr) | 292 | static inline int dquot_alloc_block(struct inode *inode, qsize_t nr) |
281 | { | 293 | { |
282 | return dquot_alloc_space(inode, nr << inode->i_blkbits); | 294 | return dquot_alloc_space(inode, nr << inode->i_blkbits); |