diff options
-rw-r--r-- | fs/dquot.c | 6 | ||||
-rw-r--r-- | include/linux/quota.h | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/fs/dquot.c b/fs/dquot.c index 74185c34a4f0..9c78ffe1aad2 100644 --- a/fs/dquot.c +++ b/fs/dquot.c | |||
@@ -847,7 +847,8 @@ static inline void dquot_incr_space(struct dquot *dquot, qsize_t number) | |||
847 | 847 | ||
848 | static inline void dquot_decr_inodes(struct dquot *dquot, qsize_t number) | 848 | static inline void dquot_decr_inodes(struct dquot *dquot, qsize_t number) |
849 | { | 849 | { |
850 | if (dquot->dq_dqb.dqb_curinodes > number) | 850 | if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE || |
851 | dquot->dq_dqb.dqb_curinodes >= number) | ||
851 | dquot->dq_dqb.dqb_curinodes -= number; | 852 | dquot->dq_dqb.dqb_curinodes -= number; |
852 | else | 853 | else |
853 | dquot->dq_dqb.dqb_curinodes = 0; | 854 | dquot->dq_dqb.dqb_curinodes = 0; |
@@ -858,7 +859,8 @@ static inline void dquot_decr_inodes(struct dquot *dquot, qsize_t number) | |||
858 | 859 | ||
859 | static inline void dquot_decr_space(struct dquot *dquot, qsize_t number) | 860 | static inline void dquot_decr_space(struct dquot *dquot, qsize_t number) |
860 | { | 861 | { |
861 | if (dquot->dq_dqb.dqb_curspace > number) | 862 | if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE || |
863 | dquot->dq_dqb.dqb_curspace >= number) | ||
862 | dquot->dq_dqb.dqb_curspace -= number; | 864 | dquot->dq_dqb.dqb_curspace -= number; |
863 | else | 865 | else |
864 | dquot->dq_dqb.dqb_curspace = 0; | 866 | dquot->dq_dqb.dqb_curspace = 0; |
diff --git a/include/linux/quota.h b/include/linux/quota.h index e51dfdc0aef0..75bf761caef2 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -168,7 +168,7 @@ enum { | |||
168 | #include <asm/atomic.h> | 168 | #include <asm/atomic.h> |
169 | 169 | ||
170 | typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */ | 170 | typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */ |
171 | typedef __u64 qsize_t; /* Type in which we store sizes */ | 171 | typedef long long qsize_t; /* Type in which we store sizes */ |
172 | 172 | ||
173 | extern spinlock_t dq_data_lock; | 173 | extern spinlock_t dq_data_lock; |
174 | 174 | ||
@@ -336,6 +336,7 @@ enum { | |||
336 | * responsible for setting | 336 | * responsible for setting |
337 | * S_NOQUOTA, S_NOATIME flags | 337 | * S_NOQUOTA, S_NOATIME flags |
338 | */ | 338 | */ |
339 | #define DQUOT_NEGATIVE_USAGE (1 << 7) /* Allow negative quota usage */ | ||
339 | 340 | ||
340 | static inline unsigned int dquot_state_flag(unsigned int flags, int type) | 341 | static inline unsigned int dquot_state_flag(unsigned int flags, int type) |
341 | { | 342 | { |