quota: Add reservation support for delayed block allocation
Subsystems (3)
PATCH v5 1/5 quota: Add reservation support for delayed block allocation
Quota: Add quota reservation support
Delayed allocation defers the block allocation at the dirty pages flush-out time, doing quota charge/check at that time is too late. But we can't charge the quota blocks until blocks are really allocated, otherwise users could get overcharged after reboot from system crash.
This patch adds quota reservation for delayed llocation. Quota blocks are reserved in memory, inode and quota won't gets dirtied until later block allocation time.
--- fs/dquot.c | 111 +++++++++++++++++++++++++++++++++-------------- include/linux/quota.h | 3 + include/linux/quotaops.h | 22 +++++++++ 3 files changed, 105 insertions(+), 31 deletions(-)
fs/dquot.c +80 -31
@@ -898,6 +898,11 @@ static inline void dquot_incr_space(stru dquot->dq_dqb.dqb_curspace += number; } +static inline void dquot_resv_space (struct dquot *dquot,qsize_t number) +{ + dquot->dq_dqb.dqb_rsvspace += number; +} +static inline void dquot_decr_inodes (struct dquot *dquot,qsize_t number) { if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE ||
@@ -1067,7 +1072,9 @@ err_out: kfree_skb(skb); }#endif - +/* +* Should called with dq_data_lock dropped, this function could sleep. +*/ static inline void flush_warnings (struct dquot *const *dquots,char *warntype) {int i;
@@ -1128,13 +1135,18 @@ static int check_idq(struct dquot *dquot/* needs dq_data_lock */ static int check_bdq (struct dquot *dquot,qsize_t space,int prealloc,char *warntype) { +qsize_t tspace; + *warntype =QUOTA_NL_NOWARN ;if (!sb_has_quota_limits_enabled (dquot->dq_sb, dquot->dq_type) ||test_bit (DQ_FAKE_B , &dquot->dq_flags))return QUOTA_OK ; + tspace = dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace + + space; +if (dquot->dq_dqb.dqb_bhardlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bhardlimit && + tspace > dquot->dq_dqb.dqb_bhardlimit && !ignore_hardlimit (dquot)) {if (!prealloc) *warntype =QUOTA_NL_BHARDWARN ;
@@ -1142,7 +1154,7 @@ static int check_bdq(struct dquot *dquot }if (dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && + tspace > dquot->dq_dqb.dqb_bsoftlimit && dquot->dq_dqb.dqb_btime &&get_seconds () >= dquot->dq_dqb.dqb_btime && !ignore_hardlimit (dquot)) {if (!prealloc)
@@ -1151,7 +1163,7 @@ static int check_bdq(struct dquot *dquot }if (dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && + tspace > dquot->dq_dqb.dqb_bsoftlimit && dquot->dq_dqb.dqb_btime ==0 ) {if (!prealloc) { *warntype =QUOTA_NL_BSOFTWARN ;
@@ -1292,51 +1304,88 @@ void vfs_dq_drop(struct inode *inode)/* * This operation can block, but only after everything is updated */ -int dquot_alloc_space (struct inode *inode,qsize_t number,int warn) +int __dquot_alloc_space (struct inode *inode,qsize_t number, +int warn,int reserve) { -int cnt, ret =NO_QUOTA ; +int cnt, ret =QUOTA_OK ;char warntype[MAXQUOTAS ]; -/* First test before acquiring mutex - solves deadlocks when we -* re-enter the quota code and are already holding the mutex */ -if (IS_NOQUOTA (inode)) { -out_add: -inode_add_bytes (inode, number); -return QUOTA_OK ; - }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) warntype[cnt] =QUOTA_NL_NOWARN ; -down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); -if (IS_NOQUOTA (inode)) {/* Now we can do reliable test... */ -up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); - goto out_add; - }spin_lock (&dq_data_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (inode->i_dquot[cnt] ==NODQUOT )continue ; -if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) ==NO_QUOTA ) - goto warn_put_all; +if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) + ==NO_QUOTA ) { + ret =NO_QUOTA ; + goto out_unlock; + } }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (inode->i_dquot[cnt] ==NODQUOT )continue ; -dquot_incr_space (inode->i_dquot[cnt], number); +if (reserve) +dquot_resv_space (inode->i_dquot[cnt], number); +else { +dquot_incr_space (inode->i_dquot[cnt], number); +inode_add_bytes (inode, number); + } } -inode_add_bytes (inode, number); - ret =QUOTA_OK ; -warn_put_all: +out_unlock:spin_unlock (&dq_data_lock); -if (ret ==QUOTA_OK ) -/* Dirtify all the dquots - this can block when journalling */ -for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) -if (inode->i_dquot[cnt]) -mark_dquot_dirty (inode->i_dquot[cnt]);flush_warnings (inode->i_dquot, warntype); +return ret; +} + +int dquot_alloc_space (struct inode *inode,qsize_t number,int warn) +{ +int cnt, ret =QUOTA_OK ; + +/* +* First test before acquiring mutex - solves deadlocks when we +* re-enter the quota code and are already holding the mutex +*/ +if (IS_NOQUOTA (inode)) + goto out; + +down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +if (IS_NOQUOTA (inode)) + goto out_unlock; + + ret =__dquot_alloc_space (inode, number, warn,0 ); +if (ret ==NO_QUOTA ) + goto out_unlock; + +/* Dirtify all the dquots - this can block when journalling */ +for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) +if (inode->i_dquot[cnt]) +mark_dquot_dirty (inode->i_dquot[cnt]); +out_unlock:up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +out: +return ret; +} + +int dquot_reserve_space (struct inode *inode,qsize_t number,int warn) +{ +int ret =QUOTA_OK ; + +if (IS_NOQUOTA (inode)) + goto out; + +down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +if (IS_NOQUOTA (inode)) + goto out_unlock; + + ret =__dquot_alloc_space (inode, number, warn,1 ); +out_unlock: +up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +out:return ret; } +EXPORT_SYMBOL (dquot_reserve_space);/* * This operation can block, but only after everything is updated
@@ -2025,7 +2074,7 @@ static void do_get_dqblk(struct dquot *dspin_lock (&dq_data_lock); di->dqb_bhardlimit =stoqb (dm->dqb_bhardlimit); di->dqb_bsoftlimit =stoqb (dm->dqb_bsoftlimit); - di->dqb_curspace = dm->dqb_curspace; + di->dqb_curspace = dm->dqb_curspace + dm->dqb_rsvspace; di->dqb_ihardlimit = dm->dqb_ihardlimit; di->dqb_isoftlimit = dm->dqb_isoftlimit; di->dqb_curinodes = dm->dqb_curinodes;
@@ -2067,7 +2116,7 @@ static int do_set_dqblk(struct dquot *dqspin_lock (&dq_data_lock);if (di->dqb_valid &QIF_SPACE ) { - dm->dqb_curspace = di->dqb_curspace; + dm->dqb_curspace = di->dqb_curspace - dm->dqb_rsvspace; check_blim =1 ;__set_bit (DQ_LASTSET_B +QIF_SPACE_B , &dquot->dq_flags); }
include/linux/quota.h +3 -0
@@ -198,6 +198,7 @@ struct mem_dqblk {qsize_t dqb_bhardlimit;/* absolute limit on disk blks alloc */ qsize_t dqb_bsoftlimit;/* preferred limit on disk blks */ qsize_t dqb_curspace;/* current used space */ +qsize_t dqb_rsvspace;/* current reserved space for delalloc*/ qsize_t dqb_ihardlimit;/* absolute limit on allocated inodes */ qsize_t dqb_isoftlimit;/* preferred inode limit */ qsize_t dqb_curinodes;/* current # allocated inodes */
@@ -308,6 +309,8 @@ struct dquot_operations {int (*release_dquot) (struct dquot *);/* Quota is going to be deleted from disk */ int (*mark_dirty) (struct dquot *);/* Dquot is marked dirty */ int (*write_info) (struct super_block *,int );/* Write of quota "superblock" */ +/* reserve quota for delayed block allocation */ +int (*reserve_space) (struct inode *,qsize_t ,int ); };/* Operations handling requests from userspace */
include/linux/quotaops.h +22 -0
@@ -185,6 +185,16 @@ static inline int vfs_dq_alloc_space(strreturn ret; } +static inline int vfs_dq_reserve_space (struct inode *inode,qsize_t nr) +{ +if (sb_any_quota_active (inode->i_sb)) { +/* Used space is updated in alloc_space() */ +if (inode->i_sb->dq_op->reserve_space (inode, nr,0 ) ==NO_QUOTA ) +return 1 ; + } +return 0 ; +} +static inline int vfs_dq_alloc_inode (struct inode *inode) {if (sb_any_quota_active (inode->i_sb)) {
@@ -341,6 +351,11 @@ static inline int vfs_dq_alloc_space(strreturn 0 ; } +static inline int vfs_dq_reserve_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);
@@ -372,12 +387,19 @@ static inline int vfs_dq_alloc_block_nod nr << inode->i_sb->s_blocksize_bits); } +static inline int vfs_dq_alloc_block (struct inode *inode,qsize_t nr) {return vfs_dq_alloc_space (inode, nr << inode->i_sb->s_blocksize_bits); } +static inline int vfs_dq_reserve_block (struct inode *inode,qsize_t nr) +{ +return vfs_dq_reserve_space (inode, + nr << inode->i_blkbits); +} +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);
Jan Kara
reviewerQuoted 7 lines · Mingming Cao
Quota: Add quota reservation support
Delayed allocation defers the block allocation at the dirty pages flush-out time, doing quota charge/check at that time is too late. But we can't charge the quota blocks until blocks are really allocated, otherwise users could get overcharged after reboot from system crash.
Quoted 5 lines
This patch adds quota reservation for delayed llocation. Quota blocks are reserved in memory, inode and quota won't gets dirtied until later block allocation time.
Signed-off-by Mingming Cao <[email protected]>
Just a few comments below:
Quoted 23 lines
--- fs/dquot.c | 111 +++++++++++++++++++++++++++++++++-------------- include/linux/quota.h | 3 + include/linux/quotaops.h | 22 +++++++++ 3 files changed, 105 insertions(+), 31 deletions(-)Index:
linux-2.6.28-git7/fs/dquot.c
===================================================================fs/dquot.c +5
-0@@ -898,6 +898,11 @@ static inline void dquot_incr_space(stru dquot->dq_dqb.dqb_curspace += number; } +static inline void dquot_resv_space (struct dquot *dquot,qsize_t number) +{ + dquot->dq_dqb.dqb_rsvspace += number; +} +static inline void dquot_decr_inodes (struct dquot *dquot,qsize_t number) { if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE ||
fs/dquot.c err_out: · line 1077
Quoted 7 lines
fs/dquot.c +3
-1@@ -1067,7 +1072,9 @@ err_out: kfree_skb(skb); }#endif - +/* +* Should called with dq_data_lock dropped, this function could sleep. +*/
If you want to add a comment here I'd add something like:
/*
* Write warnings to the console and send warning messages over netlink. *
* Note that this function can sleep.
*/
Because you cannot hold *any* spinlock when calling a function that can
sleep...
Quoted 109 lines
fs/dquot.c +30
-28static inline void flush_warnings (struct dquot *const *dquots,char *warntype) {int i;@@ -1128,13 +1135,18 @@ static int check_idq(struct dquot *dquot/* needs dq_data_lock */ static int check_bdq (struct dquot *dquot,qsize_t space,int prealloc,char *warntype) { +qsize_t tspace; + *warntype =QUOTA_NL_NOWARN ;if (!sb_has_quota_limits_enabled (dquot->dq_sb, dquot->dq_type) ||test_bit (DQ_FAKE_B , &dquot->dq_flags))return QUOTA_OK ; + tspace = dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace + + space; +if (dquot->dq_dqb.dqb_bhardlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bhardlimit && + tspace > dquot->dq_dqb.dqb_bhardlimit && !ignore_hardlimit (dquot)) {if (!prealloc) *warntype =QUOTA_NL_BHARDWARN ;@@ -1142,7 +1154,7 @@ static int check_bdq(struct dquot *dquot }if (dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && + tspace > dquot->dq_dqb.dqb_bsoftlimit && dquot->dq_dqb.dqb_btime &&get_seconds () >= dquot->dq_dqb.dqb_btime && !ignore_hardlimit (dquot)) {if (!prealloc)@@ -1151,7 +1163,7 @@ static int check_bdq(struct dquot *dquot }if (dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && + tspace > dquot->dq_dqb.dqb_bsoftlimit && dquot->dq_dqb.dqb_btime ==0 ) {if (!prealloc) { *warntype =QUOTA_NL_BSOFTWARN ;@@ -1292,51 +1304,88 @@ void vfs_dq_drop(struct inode *inode)/* * This operation can block, but only after everything is updated */ -int dquot_alloc_space (struct inode *inode,qsize_t number,int warn) +int __dquot_alloc_space (struct inode *inode,qsize_t number, +int warn,int reserve) { -int cnt, ret =NO_QUOTA ; +int cnt, ret =QUOTA_OK ;char warntype[MAXQUOTAS ]; -/* First test before acquiring mutex - solves deadlocks when we -* re-enter the quota code and are already holding the mutex */ -if (IS_NOQUOTA (inode)) { -out_add: -inode_add_bytes (inode, number); -return QUOTA_OK ; - }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) warntype[cnt] =QUOTA_NL_NOWARN ; -down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); -if (IS_NOQUOTA (inode)) {/* Now we can do reliable test... */ -up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); - goto out_add; - }spin_lock (&dq_data_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (inode->i_dquot[cnt] ==NODQUOT )continue ; -if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) ==NO_QUOTA ) - goto warn_put_all; +if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) + ==NO_QUOTA ) { + ret =NO_QUOTA ; + goto out_unlock; + } }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (inode->i_dquot[cnt] ==NODQUOT )continue ; -dquot_incr_space (inode->i_dquot[cnt], number); +if (reserve) +dquot_resv_space (inode->i_dquot[cnt], number); +else { +dquot_incr_space (inode->i_dquot[cnt], number); +inode_add_bytes (inode, number); + } } -inode_add_bytes (inode, number); - ret =QUOTA_OK ; -warn_put_all: +out_unlock:spin_unlock (&dq_data_lock); -if (ret ==QUOTA_OK ) -/* Dirtify all the dquots - this can block when journalling */ -for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) -if (inode->i_dquot[cnt]) -mark_dquot_dirty (inode->i_dquot[cnt]);flush_warnings (inode->i_dquot, warntype); +return ret; +} + +int dquot_alloc_space (struct inode *inode,qsize_t number,int warn) +{ +int cnt, ret =QUOTA_OK ; +
fs/dquot.c void vfs_dq_drop(struct inode *inode) · line 1355
Quoted 10 lines
fs/dquot.c +10
-0+/* +* First test before acquiring mutex - solves deadlocks when we +* re-enter the quota code and are already holding the mutex +*/ +if (IS_NOQUOTA (inode)) + goto out; + +down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +if (IS_NOQUOTA (inode)) + goto out_unlock;
We need to call inode_add_bytes(inode, number) even for IS_NOQUOTA()
inodes (but we don't have to hold dq_data_lock for such inodes). Your rewrite has removed this call...
Quoted 109 lines
fs/dquot.c +32
-2+ + ret =__dquot_alloc_space (inode, number, warn,0 ); +if (ret ==NO_QUOTA ) + goto out_unlock; + +/* Dirtify all the dquots - this can block when journalling */ +for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) +if (inode->i_dquot[cnt]) +mark_dquot_dirty (inode->i_dquot[cnt]); +out_unlock:up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +out: +return ret; +} + +int dquot_reserve_space (struct inode *inode,qsize_t number,int warn) +{ +int ret =QUOTA_OK ; + +if (IS_NOQUOTA (inode)) + goto out; + +down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +if (IS_NOQUOTA (inode)) + goto out_unlock; + + ret =__dquot_alloc_space (inode, number, warn,1 ); +out_unlock: +up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +out:return ret; } +EXPORT_SYMBOL (dquot_reserve_space);/* * This operation can block, but only after everything is updated @@ -2025,7 +2074,7 @@ static void do_get_dqblk(struct dquot *dspin_lock (&dq_data_lock); di->dqb_bhardlimit =stoqb (dm->dqb_bhardlimit); di->dqb_bsoftlimit =stoqb (dm->dqb_bsoftlimit); - di->dqb_curspace = dm->dqb_curspace; + di->dqb_curspace = dm->dqb_curspace + dm->dqb_rsvspace; di->dqb_ihardlimit = dm->dqb_ihardlimit; di->dqb_isoftlimit = dm->dqb_isoftlimit; di->dqb_curinodes = dm->dqb_curinodes;@@ -2067,7 +2116,7 @@ static int do_set_dqblk(struct dquot *dqspin_lock (&dq_data_lock);if (di->dqb_valid &QIF_SPACE ) { - dm->dqb_curspace = di->dqb_curspace; + dm->dqb_curspace = di->dqb_curspace - dm->dqb_rsvspace; check_blim =1 ;__set_bit (DQ_LASTSET_B +QIF_SPACE_B , &dquot->dq_flags); }Index:
linux-2.6.28-git7/include/linux/quota.h
===================================================================include/linux/quota.h +3
-0@@ -198,6 +198,7 @@ struct mem_dqblk {qsize_t dqb_bhardlimit;/* absolute limit on disk blks alloc */ qsize_t dqb_bsoftlimit;/* preferred limit on disk blks */ qsize_t dqb_curspace;/* current used space */ +qsize_t dqb_rsvspace;/* current reserved space for delalloc*/ qsize_t dqb_ihardlimit;/* absolute limit on allocated inodes */ qsize_t dqb_isoftlimit;/* preferred inode limit */ qsize_t dqb_curinodes;/* current # allocated inodes */ @@ -308,6 +309,8 @@ struct dquot_operations {int (*release_dquot) (struct dquot *);/* Quota is going to be deleted from disk */ int (*mark_dirty) (struct dquot *);/* Dquot is marked dirty */ int (*write_info) (struct super_block *,int );/* Write of quota "superblock" */ +/* reserve quota for delayed block allocation */ +int (*reserve_space) (struct inode *,qsize_t ,int ); };/* Operations handling requests from userspace */ Index:
linux-2.6.28-git7/include/linux/quotaops.h
===================================================================include/linux/quotaops.h +15
-0@@ -185,6 +185,16 @@ static inline int vfs_dq_alloc_space(strreturn ret; } +static inline int vfs_dq_reserve_space (struct inode *inode,qsize_t nr) +{ +if (sb_any_quota_active (inode->i_sb)) { +/* Used space is updated in alloc_space() */ +if (inode->i_sb->dq_op->reserve_space (inode, nr,0 ) ==NO_QUOTA ) +return 1 ; + } +return 0 ; +} +static inline int vfs_dq_alloc_inode (struct inode *inode) {if (sb_any_quota_active (inode->i_sb)) {@@ -341,6 +351,11 @@ static inline int vfs_dq_alloc_space(strreturn 0 ; } +static inline int vfs_dq_reserve_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);
include/linux/quotaops.h static inline int vfs_dq_alloc_block_nod · line 390
Quoted 4 lines
include/linux/quotaops.h +1
-0@@ -372,12 +387,19 @@ static inline int vfs_dq_alloc_block_nod nr << inode->i_sb->s_blocksize_bits); } +
^^ This empty line was added by accident I guess...
Quoted 17 lines
include/linux/quotaops.h +6
-0static inline int vfs_dq_alloc_block (struct inode *inode,qsize_t nr) {return vfs_dq_alloc_space (inode, nr << inode->i_sb->s_blocksize_bits); } +static inline int vfs_dq_reserve_block (struct inode *inode,qsize_t nr) +{ +return vfs_dq_reserve_space (inode, + nr << inode->i_blkbits); +} +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);
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Thanks for your review and suggestions. All points are taken. I have updated the quota patches.I am attaching the updated patch here just for your review.
I am waiting for the ext4 tree to updated to rebase the whole series against 2.6.29-rc1 plus ext4 patch queue.
Quoted 302 lines · 在 2009-01-06二的 11:06 +0100,Jan Kara写道:
Quoted 7 lines · Mingming Cao
Quota: Add quota reservation support
Delayed allocation defers the block allocation at the dirty pages flush-out time, doing quota charge/check at that time is too late. But we can't charge the quota blocks until blocks are really allocated, otherwise users could get overcharged after reboot from system crash.
Quoted 5 lines
This patch adds quota reservation for delayed llocation. Quota blocks are reserved in memory, inode and quota won't gets dirtied until later block allocation time.
Signed-off-by Mingming Cao <[email protected]>Just a few comments below:
Quoted 23 lines
--- fs/dquot.c | 111 +++++++++++++++++++++++++++++++++-------------- include/linux/quota.h | 3 + include/linux/quotaops.h | 22 +++++++++ 3 files changed, 105 insertions(+), 31 deletions(-)Index:
linux-2.6.28-git7/fs/dquot.c
===================================================================fs/dquot.c +5
-0@@ -898,6 +898,11 @@ static inline void dquot_incr_space(stru dquot->dq_dqb.dqb_curspace += number; } +static inline void dquot_resv_space (struct dquot *dquot,qsize_t number) +{ + dquot->dq_dqb.dqb_rsvspace += number; +} +static inline void dquot_decr_inodes (struct dquot *dquot,qsize_t number) { if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE ||fs/dquot.c err_out: · line 1077
Quoted 7 lines
fs/dquot.c +3
-1@@ -1067,7 +1072,9 @@ err_out: kfree_skb(skb); }#endif - +/* +* Should called with dq_data_lock dropped, this function could sleep. +*/ If you want to add a comment here I'd add something like:
/*
* Write warnings to the console and send warning messages over netlink. *
* Note that this function can sleep.
*/Because you cannot hold *any* spinlock when calling a function that can
sleep...Quoted 109 lines
fs/dquot.c +30
-28static inline void flush_warnings (struct dquot *const *dquots,char *warntype) {int i;@@ -1128,13 +1135,18 @@ static int check_idq(struct dquot *dquot/* needs dq_data_lock */ static int check_bdq (struct dquot *dquot,qsize_t space,int prealloc,char *warntype) { +qsize_t tspace; + *warntype =QUOTA_NL_NOWARN ;if (!sb_has_quota_limits_enabled (dquot->dq_sb, dquot->dq_type) ||test_bit (DQ_FAKE_B , &dquot->dq_flags))return QUOTA_OK ; + tspace = dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace + + space; +if (dquot->dq_dqb.dqb_bhardlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bhardlimit && + tspace > dquot->dq_dqb.dqb_bhardlimit && !ignore_hardlimit (dquot)) {if (!prealloc) *warntype =QUOTA_NL_BHARDWARN ;@@ -1142,7 +1154,7 @@ static int check_bdq(struct dquot *dquot }if (dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && + tspace > dquot->dq_dqb.dqb_bsoftlimit && dquot->dq_dqb.dqb_btime &&get_seconds () >= dquot->dq_dqb.dqb_btime && !ignore_hardlimit (dquot)) {if (!prealloc)@@ -1151,7 +1163,7 @@ static int check_bdq(struct dquot *dquot }if (dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && + tspace > dquot->dq_dqb.dqb_bsoftlimit && dquot->dq_dqb.dqb_btime ==0 ) {if (!prealloc) { *warntype =QUOTA_NL_BSOFTWARN ;@@ -1292,51 +1304,88 @@ void vfs_dq_drop(struct inode *inode)/* * This operation can block, but only after everything is updated */ -int dquot_alloc_space (struct inode *inode,qsize_t number,int warn) +int __dquot_alloc_space (struct inode *inode,qsize_t number, +int warn,int reserve) { -int cnt, ret =NO_QUOTA ; +int cnt, ret =QUOTA_OK ;char warntype[MAXQUOTAS ]; -/* First test before acquiring mutex - solves deadlocks when we -* re-enter the quota code and are already holding the mutex */ -if (IS_NOQUOTA (inode)) { -out_add: -inode_add_bytes (inode, number); -return QUOTA_OK ; - }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) warntype[cnt] =QUOTA_NL_NOWARN ; -down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); -if (IS_NOQUOTA (inode)) {/* Now we can do reliable test... */ -up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); - goto out_add; - }spin_lock (&dq_data_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (inode->i_dquot[cnt] ==NODQUOT )continue ; -if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) ==NO_QUOTA ) - goto warn_put_all; +if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) + ==NO_QUOTA ) { + ret =NO_QUOTA ; + goto out_unlock; + } }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (inode->i_dquot[cnt] ==NODQUOT )continue ; -dquot_incr_space (inode->i_dquot[cnt], number); +if (reserve) +dquot_resv_space (inode->i_dquot[cnt], number); +else { +dquot_incr_space (inode->i_dquot[cnt], number); +inode_add_bytes (inode, number); + } } -inode_add_bytes (inode, number); - ret =QUOTA_OK ; -warn_put_all: +out_unlock:spin_unlock (&dq_data_lock); -if (ret ==QUOTA_OK ) -/* Dirtify all the dquots - this can block when journalling */ -for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) -if (inode->i_dquot[cnt]) -mark_dquot_dirty (inode->i_dquot[cnt]);flush_warnings (inode->i_dquot, warntype); +return ret; +} + +int dquot_alloc_space (struct inode *inode,qsize_t number,int warn) +{ +int cnt, ret =QUOTA_OK ; +fs/dquot.c void vfs_dq_drop(struct inode *inode) · line 1355
Quoted 10 lines
fs/dquot.c +10
-0+/* +* First test before acquiring mutex - solves deadlocks when we +* re-enter the quota code and are already holding the mutex +*/ +if (IS_NOQUOTA (inode)) + goto out; + +down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +if (IS_NOQUOTA (inode)) + goto out_unlock;We need to call
inode_add_bytes(inode, number)even forIS_NOQUOTA()
inodes (but we don't have to holddq_data_lockfor such inodes). Your rewrite has removed this call...Quoted 109 lines
fs/dquot.c +32
-2+ + ret =__dquot_alloc_space (inode, number, warn,0 ); +if (ret ==NO_QUOTA ) + goto out_unlock; + +/* Dirtify all the dquots - this can block when journalling */ +for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) +if (inode->i_dquot[cnt]) +mark_dquot_dirty (inode->i_dquot[cnt]); +out_unlock:up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +out: +return ret; +} + +int dquot_reserve_space (struct inode *inode,qsize_t number,int warn) +{ +int ret =QUOTA_OK ; + +if (IS_NOQUOTA (inode)) + goto out; + +down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +if (IS_NOQUOTA (inode)) + goto out_unlock; + + ret =__dquot_alloc_space (inode, number, warn,1 ); +out_unlock: +up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +out:return ret; } +EXPORT_SYMBOL (dquot_reserve_space);/* * This operation can block, but only after everything is updated @@ -2025,7 +2074,7 @@ static void do_get_dqblk(struct dquot *dspin_lock (&dq_data_lock); di->dqb_bhardlimit =stoqb (dm->dqb_bhardlimit); di->dqb_bsoftlimit =stoqb (dm->dqb_bsoftlimit); - di->dqb_curspace = dm->dqb_curspace; + di->dqb_curspace = dm->dqb_curspace + dm->dqb_rsvspace; di->dqb_ihardlimit = dm->dqb_ihardlimit; di->dqb_isoftlimit = dm->dqb_isoftlimit; di->dqb_curinodes = dm->dqb_curinodes;@@ -2067,7 +2116,7 @@ static int do_set_dqblk(struct dquot *dqspin_lock (&dq_data_lock);if (di->dqb_valid &QIF_SPACE ) { - dm->dqb_curspace = di->dqb_curspace; + dm->dqb_curspace = di->dqb_curspace - dm->dqb_rsvspace; check_blim =1 ;__set_bit (DQ_LASTSET_B +QIF_SPACE_B , &dquot->dq_flags); }Index:
linux-2.6.28-git7/include/linux/quota.h
===================================================================include/linux/quota.h +3
-0@@ -198,6 +198,7 @@ struct mem_dqblk {qsize_t dqb_bhardlimit;/* absolute limit on disk blks alloc */ qsize_t dqb_bsoftlimit;/* preferred limit on disk blks */ qsize_t dqb_curspace;/* current used space */ +qsize_t dqb_rsvspace;/* current reserved space for delalloc*/ qsize_t dqb_ihardlimit;/* absolute limit on allocated inodes */ qsize_t dqb_isoftlimit;/* preferred inode limit */ qsize_t dqb_curinodes;/* current # allocated inodes */ @@ -308,6 +309,8 @@ struct dquot_operations {int (*release_dquot) (struct dquot *);/* Quota is going to be deleted from disk */ int (*mark_dirty) (struct dquot *);/* Dquot is marked dirty */ int (*write_info) (struct super_block *,int );/* Write of quota "superblock" */ +/* reserve quota for delayed block allocation */ +int (*reserve_space) (struct inode *,qsize_t ,int ); };/* Operations handling requests from userspace */ Index:
linux-2.6.28-git7/include/linux/quotaops.h
===================================================================include/linux/quotaops.h +15
-0@@ -185,6 +185,16 @@ static inline int vfs_dq_alloc_space(strreturn ret; } +static inline int vfs_dq_reserve_space (struct inode *inode,qsize_t nr) +{ +if (sb_any_quota_active (inode->i_sb)) { +/* Used space is updated in alloc_space() */ +if (inode->i_sb->dq_op->reserve_space (inode, nr,0 ) ==NO_QUOTA ) +return 1 ; + } +return 0 ; +} +static inline int vfs_dq_alloc_inode (struct inode *inode) {if (sb_any_quota_active (inode->i_sb)) {@@ -341,6 +351,11 @@ static inline int vfs_dq_alloc_space(strreturn 0 ; } +static inline int vfs_dq_reserve_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);include/linux/quotaops.h static inline int vfs_dq_alloc_block_nod · line 390
Quoted 4 lines
include/linux/quotaops.h +1
-0@@ -372,12 +387,19 @@ static inline int vfs_dq_alloc_block_nod nr << inode->i_sb->s_blocksize_bits); } +^^ This empty line was added by accident I guess...
Quoted 6 lines
include/linux/quotaops.h +0
-0static inline int vfs_dq_alloc_block (struct inode *inode,qsize_t nr) {return vfs_dq_alloc_space (inode, nr << inode->i_sb->s_blocksize_bits); }
Quoted 11 lines
include/linux/quotaops.h static inline int vfs_dq_alloc_block_nod · line 405
Quoted 11 lines
include/linux/quotaops.h +6
-0+static inline int vfs_dq_reserve_block (struct inode *inode,qsize_t nr) +{ +return vfs_dq_reserve_space (inode, + nr << inode->i_blkbits); +} +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);
Quota: Add quota reservation support
Delayed allocation defers the block allocation at the dirty pages flush-out time, doing quota charge/check at that time is too late. But we can't charge the quota blocks until blocks are really allocated, otherwise users could get overcharged after reboot from system crash.
This patch adds quota reservation for delayed llocation. Quota blocks are reserved in memory, inode and quota won't gets dirtied until later block allocation time.
--- fs/dquot.c | 117 ++++++++++++++++++++++++++++++++++------------- include/linux/quota.h | 3 + include/linux/quotaops.h | 21 ++++++++ 3 files changed, 110 insertions(+), 31 deletions(-)
fs/dquot.c +86 -31
@@ -898,6 +898,11 @@ static inline void dquot_incr_space(stru dquot->dq_dqb.dqb_curspace += number; } +static inline void dquot_resv_space (struct dquot *dquot,qsize_t number) +{ + dquot->dq_dqb.dqb_rsvspace += number; +} +static inline void dquot_decr_inodes (struct dquot *dquot,qsize_t number) { if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE ||
@@ -1067,7 +1072,11 @@ err_out: kfree_skb(skb); }#endif - +/* +* Write warnings to the console and send warning messages over netlink. +* +* Note that this function can sleep. +*/ static inline void flush_warnings (struct dquot *const *dquots,char *warntype) {int i;
@@ -1128,13 +1137,18 @@ static int check_idq(struct dquot *dquot/* needs dq_data_lock */ static int check_bdq (struct dquot *dquot,qsize_t space,int prealloc,char *warntype) { +qsize_t tspace; + *warntype =QUOTA_NL_NOWARN ;if (!sb_has_quota_limits_enabled (dquot->dq_sb, dquot->dq_type) ||test_bit (DQ_FAKE_B , &dquot->dq_flags))return QUOTA_OK ; + tspace = dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace + + space; +if (dquot->dq_dqb.dqb_bhardlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bhardlimit && + tspace > dquot->dq_dqb.dqb_bhardlimit && !ignore_hardlimit (dquot)) {if (!prealloc) *warntype =QUOTA_NL_BHARDWARN ;
@@ -1142,7 +1156,7 @@ static int check_bdq(struct dquot *dquot }if (dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && + tspace > dquot->dq_dqb.dqb_bsoftlimit && dquot->dq_dqb.dqb_btime &&get_seconds () >= dquot->dq_dqb.dqb_btime && !ignore_hardlimit (dquot)) {if (!prealloc)
@@ -1151,7 +1165,7 @@ static int check_bdq(struct dquot *dquot }if (dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && + tspace > dquot->dq_dqb.dqb_bsoftlimit && dquot->dq_dqb.dqb_btime ==0 ) {if (!prealloc) { *warntype =QUOTA_NL_BSOFTWARN ;
@@ -1292,51 +1306,92 @@ void vfs_dq_drop(struct inode *inode)/* * This operation can block, but only after everything is updated */ -int dquot_alloc_space (struct inode *inode,qsize_t number,int warn) +int __dquot_alloc_space (struct inode *inode,qsize_t number, +int warn,int reserve) { -int cnt, ret =NO_QUOTA ; +int cnt, ret =QUOTA_OK ;char warntype[MAXQUOTAS ]; -/* First test before acquiring mutex - solves deadlocks when we -* re-enter the quota code and are already holding the mutex */ -if (IS_NOQUOTA (inode)) { -out_add: -inode_add_bytes (inode, number); -return QUOTA_OK ; - }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) warntype[cnt] =QUOTA_NL_NOWARN ; -down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); -if (IS_NOQUOTA (inode)) {/* Now we can do reliable test... */ -up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); - goto out_add; - }spin_lock (&dq_data_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (inode->i_dquot[cnt] ==NODQUOT )continue ; -if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) ==NO_QUOTA ) - goto warn_put_all; +if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) + ==NO_QUOTA ) { + ret =NO_QUOTA ; + goto out_unlock; + } }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (inode->i_dquot[cnt] ==NODQUOT )continue ; -dquot_incr_space (inode->i_dquot[cnt], number); +if (reserve) +dquot_resv_space (inode->i_dquot[cnt], number); +else +dquot_incr_space (inode->i_dquot[cnt], number); } -inode_add_bytes (inode, number); - ret =QUOTA_OK ; -warn_put_all: +if (!reserve) +inode_add_bytes (inode, number); +out_unlock:spin_unlock (&dq_data_lock); -if (ret ==QUOTA_OK ) -/* Dirtify all the dquots - this can block when journalling */ -for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) -if (inode->i_dquot[cnt]) -mark_dquot_dirty (inode->i_dquot[cnt]);flush_warnings (inode->i_dquot, warntype); +return ret; +} + +int dquot_alloc_space (struct inode *inode,qsize_t number,int warn) +{ +int cnt, ret =QUOTA_OK ; + +/* +* First test before acquiring mutex - solves deadlocks when we +* re-enter the quota code and are already holding the mutex +*/ +if (IS_NOQUOTA (inode)) { +inode_add_bytes (inode, number); + goto out; + } + +down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +if (IS_NOQUOTA (inode)) { +inode_add_bytes (inode, number); + goto out_unlock; + } + + ret =__dquot_alloc_space (inode, number, warn,0 ); +if (ret ==NO_QUOTA ) + goto out_unlock; + +/* Dirtify all the dquots - this can block when journalling */ +for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) +if (inode->i_dquot[cnt]) +mark_dquot_dirty (inode->i_dquot[cnt]); +out_unlock:up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +out: +return ret; +} + +int dquot_reserve_space (struct inode *inode,qsize_t number,int warn) +{ +int ret =QUOTA_OK ; + +if (IS_NOQUOTA (inode)) + goto out; + +down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +if (IS_NOQUOTA (inode)) + goto out_unlock; + + ret =__dquot_alloc_space (inode, number, warn,1 ); +out_unlock: +up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +out:return ret; } +EXPORT_SYMBOL (dquot_reserve_space);/* * This operation can block, but only after everything is updated
@@ -2025,7 +2080,7 @@ static void do_get_dqblk(struct dquot *dspin_lock (&dq_data_lock); di->dqb_bhardlimit =stoqb (dm->dqb_bhardlimit); di->dqb_bsoftlimit =stoqb (dm->dqb_bsoftlimit); - di->dqb_curspace = dm->dqb_curspace; + di->dqb_curspace = dm->dqb_curspace + dm->dqb_rsvspace; di->dqb_ihardlimit = dm->dqb_ihardlimit; di->dqb_isoftlimit = dm->dqb_isoftlimit; di->dqb_curinodes = dm->dqb_curinodes;
@@ -2067,7 +2122,7 @@ static int do_set_dqblk(struct dquot *dqspin_lock (&dq_data_lock);if (di->dqb_valid &QIF_SPACE ) { - dm->dqb_curspace = di->dqb_curspace; + dm->dqb_curspace = di->dqb_curspace - dm->dqb_rsvspace; check_blim =1 ;__set_bit (DQ_LASTSET_B +QIF_SPACE_B , &dquot->dq_flags); }
include/linux/quota.h +3 -0
@@ -198,6 +198,7 @@ struct mem_dqblk {qsize_t dqb_bhardlimit;/* absolute limit on disk blks alloc */ qsize_t dqb_bsoftlimit;/* preferred limit on disk blks */ qsize_t dqb_curspace;/* current used space */ +qsize_t dqb_rsvspace;/* current reserved space for delalloc*/ qsize_t dqb_ihardlimit;/* absolute limit on allocated inodes */ qsize_t dqb_isoftlimit;/* preferred inode limit */ qsize_t dqb_curinodes;/* current # allocated inodes */
@@ -308,6 +309,8 @@ struct dquot_operations {int (*release_dquot) (struct dquot *);/* Quota is going to be deleted from disk */ int (*mark_dirty) (struct dquot *);/* Dquot is marked dirty */ int (*write_info) (struct super_block *,int );/* Write of quota "superblock" */ +/* reserve quota for delayed block allocation */ +int (*reserve_space) (struct inode *,qsize_t ,int ); };/* Operations handling requests from userspace */
include/linux/quotaops.h +21 -0
@@ -185,6 +185,16 @@ static inline int vfs_dq_alloc_space(strreturn ret; } +static inline int vfs_dq_reserve_space (struct inode *inode,qsize_t nr) +{ +if (sb_any_quota_active (inode->i_sb)) { +/* Used space is updated in alloc_space() */ +if (inode->i_sb->dq_op->reserve_space (inode, nr,0 ) ==NO_QUOTA ) +return 1 ; + } +return 0 ; +} +static inline int vfs_dq_alloc_inode (struct inode *inode) {if (sb_any_quota_active (inode->i_sb)) {
@@ -341,6 +351,11 @@ static inline int vfs_dq_alloc_space(strreturn 0 ; } +static inline int vfs_dq_reserve_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);
@@ -378,6 +393,12 @@ static inline int vfs_dq_alloc_block(str nr << inode->i_sb->s_blocksize_bits); } +static inline int vfs_dq_reserve_block (struct inode *inode,qsize_t nr) +{ +return vfs_dq_reserve_space (inode, + nr << inode->i_blkbits); +} +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);
Quoted 7 lines · Mingming Cao
Thanks for your review and suggestions. All points are taken. I have updated the quota patches.I am attaching the updated patch here just for your review.
I am waiting for the ext4 tree to updated to rebase the whole series against 2.6.29-rc1 plus ext4 patch queue.
<snip>
Quoted 7 lines
Quota: Add quota reservation support
Delayed allocation defers the block allocation at the dirty pages flush-out time, doing quota charge/check at that time is too late. But we can't charge the quota blocks until blocks are really allocated, otherwise users could get overcharged after reboot from system crash.
Quoted 5 lines
This patch adds quota reservation for delayed llocation. Quota blocks are reserved in memory, inode and quota won't gets dirtied until later block allocation time.
Signed-off-by Mingming Cao <[email protected]>
The patch is fine. You can add
How do you want to merge the patches? Via ext4 patch queue?
There's one generic quota patch that I also need to push to fix some OCFS2 issue and it collides with your patchset. And also there're further cleanups in quota code which are long overdue which I want to base on all other patches. So I've decided to setup quota git tree. I'll pull in your two VFS quota patches. Will that work for you?
The tree should be soon at:
git.kernel.org/pub/scm/linux/kernel/git/jack/linux-quota-2.6.git
The branch you can pull from is for_next (or for_mm if there'll be
some more long term experimental stuff but I'm not aware of anything like that now).
Honza
Quoted 276 lines
--- fs/dquot.c | 117 ++++++++++++++++++++++++++++++++++------------- include/linux/quota.h | 3 + include/linux/quotaops.h | 21 ++++++++ 3 files changed, 110 insertions(+), 31 deletions(-)Index:
linux-2.6.28-git7/fs/dquot.c
===================================================================fs/dquot.c +86
-31@@ -898,6 +898,11 @@ static inline void dquot_incr_space(stru dquot->dq_dqb.dqb_curspace += number; } +static inline void dquot_resv_space (struct dquot *dquot,qsize_t number) +{ + dquot->dq_dqb.dqb_rsvspace += number; +} +static inline void dquot_decr_inodes (struct dquot *dquot,qsize_t number) { if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE ||@@ -1067,7 +1072,11 @@ err_out: kfree_skb(skb); }#endif - +/* +* Write warnings to the console and send warning messages over netlink. +* +* Note that this function can sleep. +*/ static inline void flush_warnings (struct dquot *const *dquots,char *warntype) {int i;@@ -1128,13 +1137,18 @@ static int check_idq(struct dquot *dquot/* needs dq_data_lock */ static int check_bdq (struct dquot *dquot,qsize_t space,int prealloc,char *warntype) { +qsize_t tspace; + *warntype =QUOTA_NL_NOWARN ;if (!sb_has_quota_limits_enabled (dquot->dq_sb, dquot->dq_type) ||test_bit (DQ_FAKE_B , &dquot->dq_flags))return QUOTA_OK ; + tspace = dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace + + space; +if (dquot->dq_dqb.dqb_bhardlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bhardlimit && + tspace > dquot->dq_dqb.dqb_bhardlimit && !ignore_hardlimit (dquot)) {if (!prealloc) *warntype =QUOTA_NL_BHARDWARN ;@@ -1142,7 +1156,7 @@ static int check_bdq(struct dquot *dquot }if (dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && + tspace > dquot->dq_dqb.dqb_bsoftlimit && dquot->dq_dqb.dqb_btime &&get_seconds () >= dquot->dq_dqb.dqb_btime && !ignore_hardlimit (dquot)) {if (!prealloc)@@ -1151,7 +1165,7 @@ static int check_bdq(struct dquot *dquot }if (dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && + tspace > dquot->dq_dqb.dqb_bsoftlimit && dquot->dq_dqb.dqb_btime ==0 ) {if (!prealloc) { *warntype =QUOTA_NL_BSOFTWARN ;@@ -1292,51 +1306,92 @@ void vfs_dq_drop(struct inode *inode)/* * This operation can block, but only after everything is updated */ -int dquot_alloc_space (struct inode *inode,qsize_t number,int warn) +int __dquot_alloc_space (struct inode *inode,qsize_t number, +int warn,int reserve) { -int cnt, ret =NO_QUOTA ; +int cnt, ret =QUOTA_OK ;char warntype[MAXQUOTAS ]; -/* First test before acquiring mutex - solves deadlocks when we -* re-enter the quota code and are already holding the mutex */ -if (IS_NOQUOTA (inode)) { -out_add: -inode_add_bytes (inode, number); -return QUOTA_OK ; - }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) warntype[cnt] =QUOTA_NL_NOWARN ; -down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); -if (IS_NOQUOTA (inode)) {/* Now we can do reliable test... */ -up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); - goto out_add; - }spin_lock (&dq_data_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (inode->i_dquot[cnt] ==NODQUOT )continue ; -if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) ==NO_QUOTA ) - goto warn_put_all; +if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) + ==NO_QUOTA ) { + ret =NO_QUOTA ; + goto out_unlock; + } }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (inode->i_dquot[cnt] ==NODQUOT )continue ; -dquot_incr_space (inode->i_dquot[cnt], number); +if (reserve) +dquot_resv_space (inode->i_dquot[cnt], number); +else +dquot_incr_space (inode->i_dquot[cnt], number); } -inode_add_bytes (inode, number); - ret =QUOTA_OK ; -warn_put_all: +if (!reserve) +inode_add_bytes (inode, number); +out_unlock:spin_unlock (&dq_data_lock); -if (ret ==QUOTA_OK ) -/* Dirtify all the dquots - this can block when journalling */ -for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) -if (inode->i_dquot[cnt]) -mark_dquot_dirty (inode->i_dquot[cnt]);flush_warnings (inode->i_dquot, warntype); +return ret; +} + +int dquot_alloc_space (struct inode *inode,qsize_t number,int warn) +{ +int cnt, ret =QUOTA_OK ; + +/* +* First test before acquiring mutex - solves deadlocks when we +* re-enter the quota code and are already holding the mutex +*/ +if (IS_NOQUOTA (inode)) { +inode_add_bytes (inode, number); + goto out; + } + +down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +if (IS_NOQUOTA (inode)) { +inode_add_bytes (inode, number); + goto out_unlock; + } + + ret =__dquot_alloc_space (inode, number, warn,0 ); +if (ret ==NO_QUOTA ) + goto out_unlock; + +/* Dirtify all the dquots - this can block when journalling */ +for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) +if (inode->i_dquot[cnt]) +mark_dquot_dirty (inode->i_dquot[cnt]); +out_unlock:up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +out: +return ret; +} + +int dquot_reserve_space (struct inode *inode,qsize_t number,int warn) +{ +int ret =QUOTA_OK ; + +if (IS_NOQUOTA (inode)) + goto out; + +down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +if (IS_NOQUOTA (inode)) + goto out_unlock; + + ret =__dquot_alloc_space (inode, number, warn,1 ); +out_unlock: +up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +out:return ret; } +EXPORT_SYMBOL (dquot_reserve_space);/* * This operation can block, but only after everything is updated @@ -2025,7 +2080,7 @@ static void do_get_dqblk(struct dquot *dspin_lock (&dq_data_lock); di->dqb_bhardlimit =stoqb (dm->dqb_bhardlimit); di->dqb_bsoftlimit =stoqb (dm->dqb_bsoftlimit); - di->dqb_curspace = dm->dqb_curspace; + di->dqb_curspace = dm->dqb_curspace + dm->dqb_rsvspace; di->dqb_ihardlimit = dm->dqb_ihardlimit; di->dqb_isoftlimit = dm->dqb_isoftlimit; di->dqb_curinodes = dm->dqb_curinodes;@@ -2067,7 +2122,7 @@ static int do_set_dqblk(struct dquot *dqspin_lock (&dq_data_lock);if (di->dqb_valid &QIF_SPACE ) { - dm->dqb_curspace = di->dqb_curspace; + dm->dqb_curspace = di->dqb_curspace - dm->dqb_rsvspace; check_blim =1 ;__set_bit (DQ_LASTSET_B +QIF_SPACE_B , &dquot->dq_flags); }Index:
linux-2.6.28-git7/include/linux/quota.h
===================================================================include/linux/quota.h +3
-0@@ -198,6 +198,7 @@ struct mem_dqblk {qsize_t dqb_bhardlimit;/* absolute limit on disk blks alloc */ qsize_t dqb_bsoftlimit;/* preferred limit on disk blks */ qsize_t dqb_curspace;/* current used space */ +qsize_t dqb_rsvspace;/* current reserved space for delalloc*/ qsize_t dqb_ihardlimit;/* absolute limit on allocated inodes */ qsize_t dqb_isoftlimit;/* preferred inode limit */ qsize_t dqb_curinodes;/* current # allocated inodes */ @@ -308,6 +309,8 @@ struct dquot_operations {int (*release_dquot) (struct dquot *);/* Quota is going to be deleted from disk */ int (*mark_dirty) (struct dquot *);/* Dquot is marked dirty */ int (*write_info) (struct super_block *,int );/* Write of quota "superblock" */ +/* reserve quota for delayed block allocation */ +int (*reserve_space) (struct inode *,qsize_t ,int ); };/* Operations handling requests from userspace */ Index:
linux-2.6.28-git7/include/linux/quotaops.h
===================================================================include/linux/quotaops.h +21
-0@@ -185,6 +185,16 @@ static inline int vfs_dq_alloc_space(strreturn ret; } +static inline int vfs_dq_reserve_space (struct inode *inode,qsize_t nr) +{ +if (sb_any_quota_active (inode->i_sb)) { +/* Used space is updated in alloc_space() */ +if (inode->i_sb->dq_op->reserve_space (inode, nr,0 ) ==NO_QUOTA ) +return 1 ; + } +return 0 ; +} +static inline int vfs_dq_alloc_inode (struct inode *inode) {if (sb_any_quota_active (inode->i_sb)) {@@ -341,6 +351,11 @@ static inline int vfs_dq_alloc_space(strreturn 0 ; } +static inline int vfs_dq_reserve_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);@@ -378,6 +393,12 @@ static inline int vfs_dq_alloc_block(str nr << inode->i_sb->s_blocksize_bits); } +static inline int vfs_dq_reserve_block (struct inode *inode,qsize_t nr) +{ +return vfs_dq_reserve_space (inode, + nr << inode->i_blkbits); +} +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);
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Quoted 23 lines · 在 2009-01-13二的 16:37 +0100,Jan Kara写道:
Quoted 7 lines · Mingming Cao
Thanks for your review and suggestions. All points are taken. I have updated the quota patches.I am attaching the updated patch here just for your review.
I am waiting for the ext4 tree to updated to rebase the whole series against 2.6.29-rc1 plus ext4 patch queue.
<snip>
Quoted 7 lines
Quota: Add quota reservation support
Delayed allocation defers the block allocation at the dirty pages flush-out time, doing quota charge/check at that time is too late. But we can't charge the quota blocks until blocks are really allocated, otherwise users could get overcharged after reboot from system crash.
Quoted 5 lines
This patch adds quota reservation for delayed llocation. Quota blocks are reserved in memory, inode and quota won't gets dirtied until later block allocation time.
Signed-off-by Mingming Cao <[email protected]>The patch is fine. You can add
Quoted 8 lines
Acked-by Jan Kara <[email protected]>How do you want to merge the patches? Via ext4 patch queue?
There's one generic quota patch that I also need to push to fix some OCFS2 issue and it collides with your patchset. And also there're further cleanups in quota code which are long overdue which I want to base on all other patches. So I've decided to setup quota git tree. I'll pull in your two VFS quota patches. Will that work for you?
I think a quota tree is the best place to hold all these quota changes. The ext4 part probably make sense to stay together with the vfs changes, but it will need to coordinate with Ted's ext4 tree. Ted, what do you think?
BTW, there are other two quota cleanup patches that you have already acked. I will sent the 2.6.29-rc1 based version.
Quoted 275 lines
The tree should be soon at:
git.kernel.org/pub/scm/linux/kernel/git/jack/linux-quota-2.6.git
The branch you can pull from isfor_next(orfor_mmif there'll be
some more long term experimental stuff but I'm not aware of anything like that now).Honza
Quoted 267 lines
--- fs/dquot.c | 117 ++++++++++++++++++++++++++++++++++------------- include/linux/quota.h | 3 + include/linux/quotaops.h | 21 ++++++++ 3 files changed, 110 insertions(+), 31 deletions(-)Index:
linux-2.6.28-git7/fs/dquot.c
===================================================================fs/dquot.c +86
-31@@ -898,6 +898,11 @@ static inline void dquot_incr_space(stru dquot->dq_dqb.dqb_curspace += number; } +static inline void dquot_resv_space (struct dquot *dquot,qsize_t number) +{ + dquot->dq_dqb.dqb_rsvspace += number; +} +static inline void dquot_decr_inodes (struct dquot *dquot,qsize_t number) { if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE ||@@ -1067,7 +1072,11 @@ err_out: kfree_skb(skb); }#endif - +/* +* Write warnings to the console and send warning messages over netlink. +* +* Note that this function can sleep. +*/ static inline void flush_warnings (struct dquot *const *dquots,char *warntype) {int i;@@ -1128,13 +1137,18 @@ static int check_idq(struct dquot *dquot/* needs dq_data_lock */ static int check_bdq (struct dquot *dquot,qsize_t space,int prealloc,char *warntype) { +qsize_t tspace; + *warntype =QUOTA_NL_NOWARN ;if (!sb_has_quota_limits_enabled (dquot->dq_sb, dquot->dq_type) ||test_bit (DQ_FAKE_B , &dquot->dq_flags))return QUOTA_OK ; + tspace = dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace + + space; +if (dquot->dq_dqb.dqb_bhardlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bhardlimit && + tspace > dquot->dq_dqb.dqb_bhardlimit && !ignore_hardlimit (dquot)) {if (!prealloc) *warntype =QUOTA_NL_BHARDWARN ;@@ -1142,7 +1156,7 @@ static int check_bdq(struct dquot *dquot }if (dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && + tspace > dquot->dq_dqb.dqb_bsoftlimit && dquot->dq_dqb.dqb_btime &&get_seconds () >= dquot->dq_dqb.dqb_btime && !ignore_hardlimit (dquot)) {if (!prealloc)@@ -1151,7 +1165,7 @@ static int check_bdq(struct dquot *dquot }if (dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && + tspace > dquot->dq_dqb.dqb_bsoftlimit && dquot->dq_dqb.dqb_btime ==0 ) {if (!prealloc) { *warntype =QUOTA_NL_BSOFTWARN ;@@ -1292,51 +1306,92 @@ void vfs_dq_drop(struct inode *inode)/* * This operation can block, but only after everything is updated */ -int dquot_alloc_space (struct inode *inode,qsize_t number,int warn) +int __dquot_alloc_space (struct inode *inode,qsize_t number, +int warn,int reserve) { -int cnt, ret =NO_QUOTA ; +int cnt, ret =QUOTA_OK ;char warntype[MAXQUOTAS ]; -/* First test before acquiring mutex - solves deadlocks when we -* re-enter the quota code and are already holding the mutex */ -if (IS_NOQUOTA (inode)) { -out_add: -inode_add_bytes (inode, number); -return QUOTA_OK ; - }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) warntype[cnt] =QUOTA_NL_NOWARN ; -down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); -if (IS_NOQUOTA (inode)) {/* Now we can do reliable test... */ -up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); - goto out_add; - }spin_lock (&dq_data_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (inode->i_dquot[cnt] ==NODQUOT )continue ; -if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) ==NO_QUOTA ) - goto warn_put_all; +if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) + ==NO_QUOTA ) { + ret =NO_QUOTA ; + goto out_unlock; + } }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (inode->i_dquot[cnt] ==NODQUOT )continue ; -dquot_incr_space (inode->i_dquot[cnt], number); +if (reserve) +dquot_resv_space (inode->i_dquot[cnt], number); +else +dquot_incr_space (inode->i_dquot[cnt], number); } -inode_add_bytes (inode, number); - ret =QUOTA_OK ; -warn_put_all: +if (!reserve) +inode_add_bytes (inode, number); +out_unlock:spin_unlock (&dq_data_lock); -if (ret ==QUOTA_OK ) -/* Dirtify all the dquots - this can block when journalling */ -for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) -if (inode->i_dquot[cnt]) -mark_dquot_dirty (inode->i_dquot[cnt]);flush_warnings (inode->i_dquot, warntype); +return ret; +} + +int dquot_alloc_space (struct inode *inode,qsize_t number,int warn) +{ +int cnt, ret =QUOTA_OK ; + +/* +* First test before acquiring mutex - solves deadlocks when we +* re-enter the quota code and are already holding the mutex +*/ +if (IS_NOQUOTA (inode)) { +inode_add_bytes (inode, number); + goto out; + } + +down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +if (IS_NOQUOTA (inode)) { +inode_add_bytes (inode, number); + goto out_unlock; + } + + ret =__dquot_alloc_space (inode, number, warn,0 ); +if (ret ==NO_QUOTA ) + goto out_unlock; + +/* Dirtify all the dquots - this can block when journalling */ +for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) +if (inode->i_dquot[cnt]) +mark_dquot_dirty (inode->i_dquot[cnt]); +out_unlock:up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +out: +return ret; +} + +int dquot_reserve_space (struct inode *inode,qsize_t number,int warn) +{ +int ret =QUOTA_OK ; + +if (IS_NOQUOTA (inode)) + goto out; + +down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +if (IS_NOQUOTA (inode)) + goto out_unlock; + + ret =__dquot_alloc_space (inode, number, warn,1 ); +out_unlock: +up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +out:return ret; } +EXPORT_SYMBOL (dquot_reserve_space);/* * This operation can block, but only after everything is updated @@ -2025,7 +2080,7 @@ static void do_get_dqblk(struct dquot *dspin_lock (&dq_data_lock); di->dqb_bhardlimit =stoqb (dm->dqb_bhardlimit); di->dqb_bsoftlimit =stoqb (dm->dqb_bsoftlimit); - di->dqb_curspace = dm->dqb_curspace; + di->dqb_curspace = dm->dqb_curspace + dm->dqb_rsvspace; di->dqb_ihardlimit = dm->dqb_ihardlimit; di->dqb_isoftlimit = dm->dqb_isoftlimit; di->dqb_curinodes = dm->dqb_curinodes;@@ -2067,7 +2122,7 @@ static int do_set_dqblk(struct dquot *dqspin_lock (&dq_data_lock);if (di->dqb_valid &QIF_SPACE ) { - dm->dqb_curspace = di->dqb_curspace; + dm->dqb_curspace = di->dqb_curspace - dm->dqb_rsvspace; check_blim =1 ;__set_bit (DQ_LASTSET_B +QIF_SPACE_B , &dquot->dq_flags); }Index:
linux-2.6.28-git7/include/linux/quota.h
===================================================================include/linux/quota.h +3
-0@@ -198,6 +198,7 @@ struct mem_dqblk {qsize_t dqb_bhardlimit;/* absolute limit on disk blks alloc */ qsize_t dqb_bsoftlimit;/* preferred limit on disk blks */ qsize_t dqb_curspace;/* current used space */ +qsize_t dqb_rsvspace;/* current reserved space for delalloc*/ qsize_t dqb_ihardlimit;/* absolute limit on allocated inodes */ qsize_t dqb_isoftlimit;/* preferred inode limit */ qsize_t dqb_curinodes;/* current # allocated inodes */ @@ -308,6 +309,8 @@ struct dquot_operations {int (*release_dquot) (struct dquot *);/* Quota is going to be deleted from disk */ int (*mark_dirty) (struct dquot *);/* Dquot is marked dirty */ int (*write_info) (struct super_block *,int );/* Write of quota "superblock" */ +/* reserve quota for delayed block allocation */ +int (*reserve_space) (struct inode *,qsize_t ,int ); };/* Operations handling requests from userspace */ Index:
linux-2.6.28-git7/include/linux/quotaops.h
===================================================================include/linux/quotaops.h +15
-0@@ -185,6 +185,16 @@ static inline int vfs_dq_alloc_space(strreturn ret; } +static inline int vfs_dq_reserve_space (struct inode *inode,qsize_t nr) +{ +if (sb_any_quota_active (inode->i_sb)) { +/* Used space is updated in alloc_space() */ +if (inode->i_sb->dq_op->reserve_space (inode, nr,0 ) ==NO_QUOTA ) +return 1 ; + } +return 0 ; +} +static inline int vfs_dq_alloc_inode (struct inode *inode) {if (sb_any_quota_active (inode->i_sb)) {@@ -341,6 +351,11 @@ static inline int vfs_dq_alloc_space(strreturn 0 ; } +static inline int vfs_dq_reserve_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);@@ -378,6 +393,12 @@ static inline int vfs_dq_alloc_block(str nr << inode->i_sb->s_blocksize_bits); }
Quoted 10 lines
include/linux/quotaops.h static inline int vfs_dq_alloc_block(str · line 404
Quoted 9 lines
include/linux/quotaops.h +6
-0+static inline int vfs_dq_reserve_block (struct inode *inode,qsize_t nr) +{ +return vfs_dq_reserve_space (inode, + nr << inode->i_blkbits); +} +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);
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Jan Kara
reviewerQuoted 33 lines · Mingming Cao
Quoted 23 lines · 在 2009-01-13二的 16:37 +0100,Jan Kara写道:
Quoted 7 lines · Mingming Cao
Thanks for your review and suggestions. All points are taken. I have updated the quota patches.I am attaching the updated patch here just for your review.
I am waiting for the ext4 tree to updated to rebase the whole series against 2.6.29-rc1 plus ext4 patch queue.
<snip>
Quoted 7 lines
Quota: Add quota reservation support
Delayed allocation defers the block allocation at the dirty pages flush-out time, doing quota charge/check at that time is too late. But we can't charge the quota blocks until blocks are really allocated, otherwise users could get overcharged after reboot from system crash.
Quoted 5 lines
This patch adds quota reservation for delayed llocation. Quota blocks are reserved in memory, inode and quota won't gets dirtied until later block allocation time.
Signed-off-by Mingming Cao <[email protected]>The patch is fine. You can add
Quoted 8 lines
Acked-by Jan Kara <[email protected]>How do you want to merge the patches? Via ext4 patch queue?
There's one generic quota patch that I also need to push to fix some OCFS2 issue and it collides with your patchset. And also there're further cleanups in quota code which are long overdue which I want to base on all other patches. So I've decided to setup quota git tree. I'll pull in your two VFS quota patches. Will that work for you?
Quoted 4 lines
I think a quota tree is the best place to hold all these quota changes. The ext4 part probably make sense to stay together with the vfs changes, but it will need to coordinate with Ted's ext4 tree. Ted, what do you think?
Yes. The best would be if could pull quota changes from my tree but you
could also just carry your two patches and only leave merging them with vanilla to me.
Quoted 2 lines
BTW, there are other two quota cleanup patches that you have already acked. I will sent the 2.6.29-rc1 based version.
Yes. Thanks.
Quoted 5 lines
Quoted 5 lines
The tree should be soon at:
git.kernel.org/pub/scm/linux/kernel/git/jack/linux-quota-2.6.git
The branch you can pull from isfor_next(orfor_mmif there'll be
some more long term experimental stuff but I'm not aware of anything like that now).
Honza
Signature · 6 lines
Jan Kara <[email protected]> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 34 lines · 在 2009-01-13二的 20:09 +0100,Jan Kara写道:
Quoted 33 lines · Mingming Cao
Quoted 31 lines · 在 2009-01-13二的 16:37 +0100,Jan Kara写道:
Quoted 7 lines · Mingming Cao
Thanks for your review and suggestions. All points are taken. I have updated the quota patches.I am attaching the updated patch here just for your review.
I am waiting for the ext4 tree to updated to rebase the whole series against 2.6.29-rc1 plus ext4 patch queue.
<snip>
Quoted 7 lines
Quota: Add quota reservation support
Delayed allocation defers the block allocation at the dirty pages flush-out time, doing quota charge/check at that time is too late. But we can't charge the quota blocks until blocks are really allocated, otherwise users could get overcharged after reboot from system crash.
Quoted 5 lines
This patch adds quota reservation for delayed llocation. Quota blocks are reserved in memory, inode and quota won't gets dirtied until later block allocation time.
Signed-off-by Mingming Cao <[email protected]>The patch is fine. You can add
Acked-by Jan Kara <[email protected]>How do you want to merge the patches? Via ext4 patch queue?
There's one generic quota patch that I also need to push to fix some OCFS2 issue and it collides with your patchset. And also there're further cleanups in quota code which are long overdue which I want to base on all other patches. So I've decided to setup quota git tree. I'll pull in your two VFS quota patches. Will that work for you?
Quoted 8 lines
Quoted 4 lines
I think a quota tree is the best place to hold all these quota changes. The ext4 part probably make sense to stay together with the vfs changes, but it will need to coordinate with Ted's ext4 tree. Ted, what do you think?
Yes. The best would be if could pull quota changes from my tree but you
could also just carry your two patches and only leave merging them with vanilla to me.
Sure, that works for me.
Quoted 4 lines
Quoted 2 lines
BTW, there are other two quota cleanup patches that you have already acked. I will sent the 2.6.29-rc1 based version.
Yes. Thanks.
Attached are all the 5 2.6.29-rc1 based patches, including the two cleanups.
Thanks!
Mingming
Quota: Add quota reservation support
Delayed allocation defers the block allocation at the dirty pages flush-out time, doing quota charge/check at that time is too late. But we can't charge the quota blocks until blocks are really allocated, otherwise users could get overcharged after reboot from system crash.
This patch adds quota reservation for delayed llocation. Quota blocks are reserved in memory, inode and quota won't gets dirtied until later block allocation time.
--- fs/dquot.c | 117 ++++++++++++++++++++++++++++++++++------------- include/linux/quota.h | 3 + include/linux/quotaops.h | 21 ++++++++ 3 files changed, 110 insertions(+), 31 deletions(-)
fs/dquot.c +86 -31
@@ -898,6 +898,11 @@ static inline void dquot_incr_space(stru dquot->dq_dqb.dqb_curspace += number; } +static inline void dquot_resv_space (struct dquot *dquot,qsize_t number) +{ + dquot->dq_dqb.dqb_rsvspace += number; +} +static inline void dquot_decr_inodes (struct dquot *dquot,qsize_t number) { if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE ||
@@ -1067,7 +1072,11 @@ err_out: kfree_skb(skb); }#endif - +/* +* Write warnings to the console and send warning messages over netlink. +* +* Note that this function can sleep. +*/ static inline void flush_warnings (struct dquot *const *dquots,char *warntype) {int i;
@@ -1128,13 +1137,18 @@ static int check_idq(struct dquot *dquot/* needs dq_data_lock */ static int check_bdq (struct dquot *dquot,qsize_t space,int prealloc,char *warntype) { +qsize_t tspace; + *warntype =QUOTA_NL_NOWARN ;if (!sb_has_quota_limits_enabled (dquot->dq_sb, dquot->dq_type) ||test_bit (DQ_FAKE_B , &dquot->dq_flags))return QUOTA_OK ; + tspace = dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace + + space; +if (dquot->dq_dqb.dqb_bhardlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bhardlimit && + tspace > dquot->dq_dqb.dqb_bhardlimit && !ignore_hardlimit (dquot)) {if (!prealloc) *warntype =QUOTA_NL_BHARDWARN ;
@@ -1142,7 +1156,7 @@ static int check_bdq(struct dquot *dquot }if (dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && + tspace > dquot->dq_dqb.dqb_bsoftlimit && dquot->dq_dqb.dqb_btime &&get_seconds () >= dquot->dq_dqb.dqb_btime && !ignore_hardlimit (dquot)) {if (!prealloc)
@@ -1151,7 +1165,7 @@ static int check_bdq(struct dquot *dquot }if (dquot->dq_dqb.dqb_bsoftlimit && - dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit && + tspace > dquot->dq_dqb.dqb_bsoftlimit && dquot->dq_dqb.dqb_btime ==0 ) {if (!prealloc) { *warntype =QUOTA_NL_BSOFTWARN ;
@@ -1292,51 +1306,92 @@ void vfs_dq_drop(struct inode *inode)/* * This operation can block, but only after everything is updated */ -int dquot_alloc_space (struct inode *inode,qsize_t number,int warn) +int __dquot_alloc_space (struct inode *inode,qsize_t number, +int warn,int reserve) { -int cnt, ret =NO_QUOTA ; +int cnt, ret =QUOTA_OK ;char warntype[MAXQUOTAS ]; -/* First test before acquiring mutex - solves deadlocks when we -* re-enter the quota code and are already holding the mutex */ -if (IS_NOQUOTA (inode)) { -out_add: -inode_add_bytes (inode, number); -return QUOTA_OK ; - }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) warntype[cnt] =QUOTA_NL_NOWARN ; -down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); -if (IS_NOQUOTA (inode)) {/* Now we can do reliable test... */ -up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); - goto out_add; - }spin_lock (&dq_data_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (inode->i_dquot[cnt] ==NODQUOT )continue ; -if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) ==NO_QUOTA ) - goto warn_put_all; +if (check_bdq (inode->i_dquot[cnt], number, warn, warntype+cnt) + ==NO_QUOTA ) { + ret =NO_QUOTA ; + goto out_unlock; + } }for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {if (inode->i_dquot[cnt] ==NODQUOT )continue ; -dquot_incr_space (inode->i_dquot[cnt], number); +if (reserve) +dquot_resv_space (inode->i_dquot[cnt], number); +else +dquot_incr_space (inode->i_dquot[cnt], number); } -inode_add_bytes (inode, number); - ret =QUOTA_OK ; -warn_put_all: +if (!reserve) +inode_add_bytes (inode, number); +out_unlock:spin_unlock (&dq_data_lock); -if (ret ==QUOTA_OK ) -/* Dirtify all the dquots - this can block when journalling */ -for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) -if (inode->i_dquot[cnt]) -mark_dquot_dirty (inode->i_dquot[cnt]);flush_warnings (inode->i_dquot, warntype); +return ret; +} + +int dquot_alloc_space (struct inode *inode,qsize_t number,int warn) +{ +int cnt, ret =QUOTA_OK ; + +/* +* First test before acquiring mutex - solves deadlocks when we +* re-enter the quota code and are already holding the mutex +*/ +if (IS_NOQUOTA (inode)) { +inode_add_bytes (inode, number); + goto out; + } + +down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +if (IS_NOQUOTA (inode)) { +inode_add_bytes (inode, number); + goto out_unlock; + } + + ret =__dquot_alloc_space (inode, number, warn,0 ); +if (ret ==NO_QUOTA ) + goto out_unlock; + +/* Dirtify all the dquots - this can block when journalling */ +for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) +if (inode->i_dquot[cnt]) +mark_dquot_dirty (inode->i_dquot[cnt]); +out_unlock:up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +out: +return ret; +} + +int dquot_reserve_space (struct inode *inode,qsize_t number,int warn) +{ +int ret =QUOTA_OK ; + +if (IS_NOQUOTA (inode)) + goto out; + +down_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +if (IS_NOQUOTA (inode)) + goto out_unlock; + + ret =__dquot_alloc_space (inode, number, warn,1 ); +out_unlock: +up_read (&sb_dqopt (inode->i_sb)->dqptr_sem); +out:return ret; } +EXPORT_SYMBOL (dquot_reserve_space);/* * This operation can block, but only after everything is updated
@@ -2025,7 +2080,7 @@ static void do_get_dqblk(struct dquot *dspin_lock (&dq_data_lock); di->dqb_bhardlimit =stoqb (dm->dqb_bhardlimit); di->dqb_bsoftlimit =stoqb (dm->dqb_bsoftlimit); - di->dqb_curspace = dm->dqb_curspace; + di->dqb_curspace = dm->dqb_curspace + dm->dqb_rsvspace; di->dqb_ihardlimit = dm->dqb_ihardlimit; di->dqb_isoftlimit = dm->dqb_isoftlimit; di->dqb_curinodes = dm->dqb_curinodes;
@@ -2067,7 +2122,7 @@ static int do_set_dqblk(struct dquot *dqspin_lock (&dq_data_lock);if (di->dqb_valid &QIF_SPACE ) { - dm->dqb_curspace = di->dqb_curspace; + dm->dqb_curspace = di->dqb_curspace - dm->dqb_rsvspace; check_blim =1 ;__set_bit (DQ_LASTSET_B +QIF_SPACE_B , &dquot->dq_flags); }
include/linux/quota.h +3 -0
@@ -198,6 +198,7 @@ struct mem_dqblk {qsize_t dqb_bhardlimit;/* absolute limit on disk blks alloc */ qsize_t dqb_bsoftlimit;/* preferred limit on disk blks */ qsize_t dqb_curspace;/* current used space */ +qsize_t dqb_rsvspace;/* current reserved space for delalloc*/ qsize_t dqb_ihardlimit;/* absolute limit on allocated inodes */ qsize_t dqb_isoftlimit;/* preferred inode limit */ qsize_t dqb_curinodes;/* current # allocated inodes */
@@ -308,6 +309,8 @@ struct dquot_operations {int (*release_dquot) (struct dquot *);/* Quota is going to be deleted from disk */ int (*mark_dirty) (struct dquot *);/* Dquot is marked dirty */ int (*write_info) (struct super_block *,int );/* Write of quota "superblock" */ +/* reserve quota for delayed block allocation */ +int (*reserve_space) (struct inode *,qsize_t ,int ); };/* Operations handling requests from userspace */
include/linux/quotaops.h +21 -0
@@ -185,6 +185,16 @@ static inline int vfs_dq_alloc_space(strreturn ret; } +static inline int vfs_dq_reserve_space (struct inode *inode,qsize_t nr) +{ +if (sb_any_quota_active (inode->i_sb)) { +/* Used space is updated in alloc_space() */ +if (inode->i_sb->dq_op->reserve_space (inode, nr,0 ) ==NO_QUOTA ) +return 1 ; + } +return 0 ; +} +static inline int vfs_dq_alloc_inode (struct inode *inode) {if (sb_any_quota_active (inode->i_sb)) {
@@ -341,6 +351,11 @@ static inline int vfs_dq_alloc_space(strreturn 0 ; } +static inline int vfs_dq_reserve_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);
@@ -378,6 +393,12 @@ static inline int vfs_dq_alloc_block(str nr << inode->i_sb->s_blocksize_bits); } +static inline int vfs_dq_reserve_block (struct inode *inode,qsize_t nr) +{ +return vfs_dq_reserve_space (inode, + nr << inode->i_blkbits); +} +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);
quota: Add quota reservation claim and released operations
Reserved quota will be claimed at the block allocation time. Over-booked quota could be returned back with the release callback function.
--- fs/dquot.c | 110 +++++++++++++++++++++++++++++++++++++++++++++-- include/linux/quota.h | 6 ++ include/linux/quotaops.h | 53 ++++++++++++++++++++++ 3 files changed, 165 insertions(+), 4 deletions(-)
include/linux/quota.h +6 -0
@@ -311,6 +311,12 @@ struct dquot_operations {int (*write_info) (struct super_block *,int );/* Write of quota "superblock" */ /* reserve quota for delayed block allocation */ int (*reserve_space) (struct inode *,qsize_t ,int ); +/* claim reserved quota for delayed alloc */ +int (*claim_space) (struct inode *,qsize_t ); +/* release rsved quota for delayed alloc */ +void (*release_rsv) (struct inode *,qsize_t ); +/* get reserved quota for delayed alloc */ +qsize_t (*get_reserved_space) (struct inode *); };/* Operations handling requests from userspace */
include/linux/quotaops.h +53 -0
77 lines not on this page · raw message
fs/dquot.c +106 -4
149 lines not on this page · raw message
ext4: quota reservation for delayed allocation
Uses quota reservation/claim/release to handle quota properly for delayed allocation in the three steps: 1) quotas are reserved when data being copied to cache when block allocation is defered 2) when new blocks are allocated. reserved quotas are converted to the real allocated quota, 2) over-booked quotas for metadata blocks are released back.
--- fs/ext4/ext4.h | 1 + fs/ext4/inode.c | 36 +++++++++++++++++++++++++++++++++--- fs/ext4/mballoc.c | 44 ++++++++++++++++++++++++++------------------ fs/ext4/super.c | 4 ++++ 4 files changed, 64 insertions(+), 21 deletions(-)
fs/ext4/inode.c +33 -3
@@ -973,6 +973,17 @@ out:return err; } +qsize_t ext4_get_reserved_space (struct inode *inode) +{ +unsigned long long total; + +spin_lock (&EXT4_I (inode)->i_block_reservation_lock); + total =EXT4_I (inode)->i_reserved_data_blocks + +EXT4_I (inode)->i_reserved_meta_blocks; +spin_unlock (&EXT4_I (inode)->i_block_reservation_lock); + +return (qsize_t )total << inode->i_blkbits; +}/* * Calculate the number of metadata blocks need to reserve * to allocate @blocks for non extent file based file
@@ -1034,8 +1045,14 @@ static void ext4_da_update_reserve_space/* update per-inode reservations */ BUG_ON (used >EXT4_I (inode)->i_reserved_data_blocks);EXT4_I (inode)->i_reserved_data_blocks -= used; -spin_unlock (&EXT4_I (inode)->i_block_reservation_lock); + +/* +* free those over-booking quota for metadata blocks +*/ + +if (mdb_free) +vfs_dq_release_reservation_block (inode, mdb_free); }/*
@@ -1547,8 +1564,8 @@ static int ext4_journalled_write_end(strstatic int ext4_da_reserve_space (struct inode *inode,int nrblocks) {int retries =0 ; -struct ext4_sb_info *sbi =EXT4_SB (inode->i_sb); -unsigned long md_needed, mdblocks, total =0 ; +struct ext4_sb_info *sbi =EXT4_SB (inode->i_sb); +unsigned long md_needed, mdblocks, total =0 ;/* * recalculate the amount of metadata blocks to reserve
@@ -1564,12 +1581,23 @@ repeat: md_needed = mdblocks -EXT4_I (inode)->i_reserved_meta_blocks; total = md_needed + nrblocks; +/* +* Make quota reservation here to prevent quota overflow +* later. Real quota accounting is done at pages writeout +* time. +*/ +if (vfs_dq_reserve_block (inode, total)) { +spin_unlock (&EXT4_I (inode)->i_block_reservation_lock); +return -EDQUOT ; + } +if (ext4_claim_free_blocks (sbi, total)) {spin_unlock (&EXT4_I (inode)->i_block_reservation_lock);if (ext4_should_retry_alloc (inode->i_sb, &retries)) {yield (); goto repeat; } +vfs_dq_release_reservation_block (inode, total);return -ENOSPC ; }EXT4_I (inode)->i_reserved_data_blocks += nrblocks;
@@ -1623,6 +1651,8 @@ static void ext4_da_release_space(structBUG_ON (mdb >EXT4_I (inode)->i_reserved_meta_blocks);EXT4_I (inode)->i_reserved_meta_blocks = mdb;spin_unlock (&EXT4_I (inode)->i_block_reservation_lock); + +vfs_dq_release_reservation_block (inode, release); } static void ext4_da_page_release_reservation(struct page *page,
fs/ext4/super.c +4 -0
@@ -945,6 +945,10 @@ static struct dquot_operations ext4_quot .initialize = ext4_dquot_initialize, .drop = ext4_dquot_drop, .alloc_space = dquot_alloc_space, + .reserve_space = dquot_reserve_space, + .claim_space = dquot_claim_space, + .release_rsv = dquot_release_reserved_space, + .get_reserved_space = ext4_get_reserved_space, .alloc_inode = dquot_alloc_inode, .free_space = dquot_free_space, .free_inode = dquot_free_inode,
fs/ext4/mballoc.c +26 -18
77 lines not on this page · raw message
fs/ext4/ext4.h +1 -0
@@ -1098,6 +1098,7 @@ extern int ext4_chunk_trans_blocks(strucextern int ext4_block_truncate_page (handle_t *handle,struct address_space *mapping,loff_t from);extern int ext4_page_mkwrite (struct vm_area_struct *vma,struct page *page); +extern qsize_t ext4_get_reserved_space (struct inode *inode);/* ioctl.c */ extern long ext4_ioctl (struct file *,unsigned int ,unsigned long );
quota: Use inode->i_blkbits to get block bits
From: Mingming Cao <[email protected]>
Andrew has suggested to use inode->i_blkbits to get the block bits info, rather than use super block's blockbits. That should be faster and emit less code.
--- include/linux/quotaops.h | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)
include/linux/quotaops.h +8 -14
@@ -412,38 +412,32 @@ static inline void vfs_dq_free_space(strstatic inline int vfs_dq_prealloc_block_nodirty (struct inode *inode,qsize_t nr) { -return vfs_dq_prealloc_space_nodirty (inode, - nr << inode->i_sb->s_blocksize_bits); +return vfs_dq_prealloc_space_nodirty (inode, nr << inode->i_blkbits); }static inline int vfs_dq_prealloc_block (struct inode *inode,qsize_t nr) { -return vfs_dq_prealloc_space (inode, - nr << inode->i_sb->s_blocksize_bits); +return vfs_dq_prealloc_space (inode, nr << inode->i_blkbits); }static inline int vfs_dq_alloc_block_nodirty (struct inode *inode,qsize_t nr) { -return vfs_dq_alloc_space_nodirty (inode, - nr << inode->i_sb->s_blocksize_bits); +return vfs_dq_alloc_space_nodirty (inode, nr << inode->i_blkbits); }static inline int vfs_dq_alloc_block (struct inode *inode,qsize_t nr) { -return vfs_dq_alloc_space (inode, - nr << inode->i_sb->s_blocksize_bits); +return vfs_dq_alloc_space (inode, nr << inode->i_blkbits); }static inline int vfs_dq_reserve_block (struct inode *inode,qsize_t nr) { -return vfs_dq_reserve_space (inode, - nr << inode->i_blkbits); +return vfs_dq_reserve_space (inode, nr << inode->i_blkbits); }static inline int vfs_dq_claim_block (struct inode *inode,qsize_t nr) { -return vfs_dq_claim_space (inode, - nr << inode->i_blkbits); +return vfs_dq_claim_space (inode, nr << inode->i_blkbits); } static inline
@@ -454,12 +448,12 @@ void vfs_dq_release_reservation_block(ststatic 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); +vfs_dq_free_space_nodirty (inode, nr << inode->i_blkbits); }static inline void vfs_dq_free_block (struct inode *inode,qsize_t nr) { -vfs_dq_free_space (inode, nr << inode->i_sb->s_blocksize_bits); +vfs_dq_free_space (inode, nr << inode->i_blkbits); }/*
quota: Move EXPORT_SYMBOL immediatlely next to the functions/varibles
From: Mingming Cao <[email protected]>
According to checkpatch: EXPORT_SYMBOL(foo); should immediately follow its
function/variable
--- fs/dquot.c | 73 +++++++++++++++++++++++++++++-------------------------------- 1 file changed, 35 insertions(+), 38 deletions(-)
fs/dquot.c +35 -38
286 lines not on this page · raw message
Jan Kara
reviewerQuoted 4 lines · Mingming Cao
Attached are all the 5 2.6.29-rc1 based patches, including the two cleanups.
Thanks!
OK, merged the two cleanups.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Hi mingming:
I have tested your patch in 2.6.29-rc1. The sum of characters which i had written were fewer than the block softlimit,but a warning occurs.
# edquota -u quser1 Disk quotas for user quser1 (uid 504): Filesystem blocks soft hard inodes soft hard /dev/sda7 0 5 10 0 5 10
Steps to reproduce:
# mkfs.ext4 /dev/sda7 # mount /dev/sda7 /mnt -t ext4 # setquota -u quser1 5 10 5 10 /mnt
Then log in as quser1
$ cd /mnt $ ll total 20 -rw------- 1 root root 7168 01-20 01:51 aquota.user drwx------ 2 root root 12288 01-20 01:44 lost+found $ vim dd.sh
I written some characters,such as abc,then i do wq, the warning occurs likes below:
"dd.sh" sda7: write failed, user block limit reached.
Quoted 49 lines · Mingming Cao
Quoted 33 lines · 在 2009-01-13二的 20:09 +0100,Jan Kara写道:
Quoted 32 lines · Mingming Cao
Quoted 31 lines · 在 2009-01-13二的 16:37 +0100,Jan Kara写道:
Quoted 7 lines · Mingming Cao
Thanks for your review and suggestions. All points are taken. I have updated the quota patches.I am attaching the updated patch here just for your review.
I am waiting for the ext4 tree to updated to rebase the whole series against 2.6.29-rc1 plus ext4 patch queue.
<snip>
Quoted 7 lines
Quota: Add quota reservation support
Delayed allocation defers the block allocation at the dirty pages flush-out time, doing quota charge/check at that time is too late. But we can't charge the quota blocks until blocks are really allocated, otherwise users could get overcharged after reboot from system crash.
Quoted 5 lines
This patch adds quota reservation for delayed llocation. Quota blocks are reserved in memory, inode and quota won't gets dirtied until later block allocation time.
Signed-off-by Mingming Cao <[email protected]>The patch is fine. You can add
Acked-by Jan Kara <[email protected]>How do you want to merge the patches? Via ext4 patch queue?
There's one generic quota patch that I also need to push to fix some OCFS2 issue and it collides with your patchset. And also there're further cleanups in quota code which are long overdue which I want to base on all other patches. So I've decided to setup quota git tree. I'll pull in your two VFS quota patches. Will that work for you?Quoted 8 lines
Quoted 4 lines
I think a quota tree is the best place to hold all these quota changes. The ext4 part probably make sense to stay together with the vfs changes, but it will need to coordinate with Ted's ext4 tree. Ted, what do you think?
Yes. The best would be if could pull quota changes from my tree but you
could also just carry your two patches and only leave merging them with vanilla to me.Sure, that works for me.
Quoted 4 lines
Quoted 2 lines
BTW, there are other two quota cleanup patches that you have already acked. I will sent the 2.6.29-rc1 based version.
Yes. Thanks.
Quoted 7 lines
Attached are all the 5 2.6.29-rc1 based patches, including the two cleanups.
Thanks!
Mingming
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Jan Kara
reviewerHi,
Quoted 2 lines
I have tested your patch in 2.6.29-rc1. The sum of characters which i had written were fewer than the block softlimit,but a warning occurs.
I haven't seen any reply to this. Did it get resolved?
Quoted 11 lines
# edquota -u quser1 Disk quotas for user quser1 (uid 504): Filesystem blocks soft hard inodes soft hard /dev/sda7 0 5 10 0 5 10Steps to reproduce:
# mkfs.ext4 /dev/sda7 # mount /dev/sda7 /mnt -t ext4 # setquota -u quser1 5 10 5 10 /mnt
Quoted 7 lines
Then log in as quser1
$ cd /mnt $ ll total 20 -rw------- 1 root root 7168 01-20 01:51 aquota.user drwx------ 2 root root 12288 01-20 01:44 lost+found $ vim dd.sh
Well, vim creates backup files and possibly some other stuff so it's
quite possible that the block limit of 10 KB has been exceeded. Could you verify that e.g.: echo "abc" >dd.sh
works as expected (you should then see 4KB used).
Quoted 3 lines
I written some characters,such as abc,then i do wq, the warning occurs likes below:
"dd.sh" sda7: write failed, user block limit reached.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SuSE CR Labs