--- fs/dquot.c | 37 +++++++++++++++++++++++++++++++++++++ include/linux/quota.h | 1 + include/linux/quotaops.h | 25 +++++++++++++++++++++++++ 3 files changed, 63 insertions(+) Index: linux-2.6.27-rc3-quota/include/linux/quota.h =================================================================== --- linux-2.6.27-rc3-quota.orig/include/linux/quota.h 2008-09-22 17:04:48.000000000 -0700 +++ linux-2.6.27-rc3-quota/include/linux/quota.h 2008-09-22 17:04:54.000000000 -0700 @@ -300,6 +300,7 @@ struct dquot_operations { int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */ int (*reserve_space) (struct inode *, qsize_t, int); /* reserve quota for delayed block allocation */ int (*claim_space) (struct inode *, qsize_t, int); /* claim reserved quota for delayed block allocation */ + int (*free_space) (struct inode *, qsize_t, int); /* free reserved quota for delayed block allocation */ }; /* Operations handling requests from userspace */ Index: linux-2.6.27-rc3-quota/include/linux/quotaops.h =================================================================== --- linux-2.6.27-rc3-quota.orig/include/linux/quotaops.h 2008-09-22 17:04:48.000000000 -0700 +++ linux-2.6.27-rc3-quota/include/linux/quotaops.h 2008-09-22 17:09:11.000000000 -0700 @@ -172,6 +172,19 @@ static inline int vfs_dq_alloc_inode(str } return 0; } +static inline int vfs_dq_free_space(struct inode *inode, qsize_t nr) +{ + if (sb_any_quota_enabled(inode->i_sb)) { + /* Used space is updated in alloc_space() */ + if (inode->i_sb->dq_op->free_space(inode, nr, 0) == NO_QUOTA) + return 1; + } + return 0; +} static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) { @@ -303,6 +316,11 @@ static inline int vfs_dq_reserve_space(s return 0; } +static inline int vfs_dq_free_space(struct inode *inode, qsize_t nr) +{ + return 0; +} + static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) { inode_sub_bytes(inode, nr); @@ -347,6 +365,12 @@ static inline int vfs_dq_reserve_block(s nr << inode->i_sb->s_blocksize_bits); } +static inline int vfs_dq_free_block(struct inode *inode, qsize_t nr) +{ + return vfs_dq_free_space(inode, + nr << inode->i_sb->s_blocksize_bits); +} + static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr) { vfs_dq_free_space_nodirty(inode, nr << inode->i_sb->s_blocksize_bits); @@ -376,6 +400,7 @@ static inline void vfs_dq_free_block(str vfs_dq_alloc_block_nodirty(inode, nr) #define DQUOT_ALLOC_BLOCK(inode, nr) vfs_dq_alloc_block(inode, nr) #define DQUOT_RESERVE_BLOCK(inode, nr) vfs_dq_reserve_block(inode, nr) #define DQUOT_CLAIM_BLOCK(inode, nr) vfs_dq_claim_block(inode, nr) +#define DQUOT_FREE_RSV_BLOCK(inode, nr) vfs_dq_free_space(inode, nr) #define DQUOT_ALLOC_INODE(inode) vfs_dq_alloc_inode(inode) #define DQUOT_FREE_SPACE_NODIRTY(inode, nr) \ vfs_dq_free_space_nodirty(inode, nr) Index: linux-2.6.27-rc3-quota/fs/dquot.c =================================================================== --- linux-2.6.27-rc3-quota.orig/fs/dquot.c 2008-09-22 17:09:23.000000000 -0700 +++ linux-2.6.27-rc3-quota/fs/dquot.c 2008-09-22 17:29:14.000000000 -0700 @@ -1317,6 +1325,35 @@ int dquot_reserve_space(struct inode *in return ret; } +int dquot_free_reserved_space(struct inode *inode, qsize_t number, int warn) +{ + + if (IS_NOQUOTA(inode)) { + return 0; + } + dquot->dq_dqb.dqb_rsvspace -= number; + return 0; +} /* * This operation can block, but only after everything is updated */