Add patch SR-ext4-resize-mark-new-group-EXT_BG_INODE_ZEROED.patch
[ext4-patch-queue/an.git] / quota-free-reservation-vfs.patch
blob8953bd26487995eba2e196d7ba4b409f056b5627
1 ---
2 fs/dquot.c | 37 +++++++++++++++++++++++++++++++++++++
3 include/linux/quota.h | 1 +
4 include/linux/quotaops.h | 25 +++++++++++++++++++++++++
5 3 files changed, 63 insertions(+)
7 Index: linux-2.6.27-rc3-quota/include/linux/quota.h
8 ===================================================================
9 --- linux-2.6.27-rc3-quota.orig/include/linux/quota.h 2008-09-22 17:04:48.000000000 -0700
10 +++ linux-2.6.27-rc3-quota/include/linux/quota.h 2008-09-22 17:04:54.000000000 -0700
11 @@ -300,6 +300,7 @@ struct dquot_operations {
12 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */
13 int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */
14 int (*reserve_space) (struct inode *, qsize_t, int); /* reserve quota for delayed block allocation */
15 int (*claim_space) (struct inode *, qsize_t, int); /* claim reserved quota for delayed block allocation */
16 + int (*free_space) (struct inode *, qsize_t, int); /* free reserved quota for delayed block allocation */
19 /* Operations handling requests from userspace */
20 Index: linux-2.6.27-rc3-quota/include/linux/quotaops.h
21 ===================================================================
22 --- linux-2.6.27-rc3-quota.orig/include/linux/quotaops.h 2008-09-22 17:04:48.000000000 -0700
23 +++ linux-2.6.27-rc3-quota/include/linux/quotaops.h 2008-09-22 17:09:11.000000000 -0700
24 @@ -172,6 +172,19 @@ static inline int vfs_dq_alloc_inode(str
26 return 0;
28 +static inline int vfs_dq_free_space(struct inode *inode, qsize_t nr)
30 + if (sb_any_quota_enabled(inode->i_sb)) {
31 + /* Used space is updated in alloc_space() */
32 + if (inode->i_sb->dq_op->free_space(inode, nr, 0) == NO_QUOTA)
33 + return 1;
34 + }
35 + return 0;
38 static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
40 @@ -303,6 +316,11 @@ static inline int vfs_dq_reserve_space(s
41 return 0;
44 +static inline int vfs_dq_free_space(struct inode *inode, qsize_t nr)
46 + return 0;
49 static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
51 inode_sub_bytes(inode, nr);
52 @@ -347,6 +365,12 @@ static inline int vfs_dq_reserve_block(s
53 nr << inode->i_sb->s_blocksize_bits);
56 +static inline int vfs_dq_free_block(struct inode *inode, qsize_t nr)
58 + return vfs_dq_free_space(inode,
59 + nr << inode->i_sb->s_blocksize_bits);
62 static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr)
64 vfs_dq_free_space_nodirty(inode, nr << inode->i_sb->s_blocksize_bits);
65 @@ -376,6 +400,7 @@ static inline void vfs_dq_free_block(str
66 vfs_dq_alloc_block_nodirty(inode, nr)
67 #define DQUOT_ALLOC_BLOCK(inode, nr) vfs_dq_alloc_block(inode, nr)
68 #define DQUOT_RESERVE_BLOCK(inode, nr) vfs_dq_reserve_block(inode, nr)
69 #define DQUOT_CLAIM_BLOCK(inode, nr) vfs_dq_claim_block(inode, nr)
70 +#define DQUOT_FREE_RSV_BLOCK(inode, nr) vfs_dq_free_space(inode, nr)
71 #define DQUOT_ALLOC_INODE(inode) vfs_dq_alloc_inode(inode)
72 #define DQUOT_FREE_SPACE_NODIRTY(inode, nr) \
73 vfs_dq_free_space_nodirty(inode, nr)
74 Index: linux-2.6.27-rc3-quota/fs/dquot.c
75 ===================================================================
76 --- linux-2.6.27-rc3-quota.orig/fs/dquot.c 2008-09-22 17:09:23.000000000 -0700
77 +++ linux-2.6.27-rc3-quota/fs/dquot.c 2008-09-22 17:29:14.000000000 -0700
78 @@ -1317,6 +1325,35 @@ int dquot_reserve_space(struct inode *in
79 return ret;
82 +int dquot_free_reserved_space(struct inode *inode, qsize_t number, int warn)
85 + if (IS_NOQUOTA(inode)) {
86 + return 0;
87 + }
88 + dquot->dq_dqb.dqb_rsvspace -= number;
89 + return 0;
92 * This operation can block, but only after everything is updated