Skip to contentSkip to conversation

quota: remove unnecessary check in dquot_add_inodes() and dquot_add_space()

PATCH In review Chengguang Xu 2 participants 2 messages Nov 17, 2019 – Nov 19, 2019 Diskquota

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 quota: remove unnecessary check in dquot_add_inodes() and dquot_add_space()

After passed grace time we treat softlimit as hardlimit, so we don't have to compare desire usage with softlimit in this place.

---
 fs/quota/dquot.c | 2 --
 1 file changed, 2 deletions(-)
fs/quota/dquot.c +0 -2
index 6e826b454082..97740077afac 100644
@@ -1283,7 +1283,6 @@ static int dquot_add_inodes(struct dquot *dquot, qsize_t inodes,
 	}
 
 	if (dquot->dq_dqb.dqb_isoftlimit &&
-	    newinodes > dquot->dq_dqb.dqb_isoftlimit &&
 	    dquot->dq_dqb.dqb_itime &&
 	    ktime_get_real_seconds() >= dquot->dq_dqb.dqb_itime &&
             !ignore_hardlimit(dquot)) {
@@ -1333,7 +1332,6 @@ static int dquot_add_space(struct dquot *dquot, qsize_t space,
 	}
 
 	if (dquot->dq_dqb.dqb_bsoftlimit &&
-	    tspace > dquot->dq_dqb.dqb_bsoftlimit &&
 	    dquot->dq_dqb.dqb_btime &&
 	    ktime_get_real_seconds() >= dquot->dq_dqb.dqb_btime &&
             !ignore_hardlimit(dquot)) {
Signature · 1 line
2.21.0
#1 lore raw
Quoted 5 lines · Chengguang Xu

After passed grace time we treat softlimit as hardlimit, so we don't have to compare desire usage with softlimit in this place.

Thanks for the patch! I guess you mean that when dqb_itime is set, we are sure that softlimit is exceeded. You are right but the benefit of your change is not big and I prefer to keep the current "defensive" condition.

Honza

Quoted 29 lines
---
 fs/quota/dquot.c | 2 --
 1 file changed, 2 deletions(-)
fs/quota/dquot.c +0 -2
index 6e826b454082..97740077afac 100644
@@ -1283,7 +1283,6 @@ static int dquot_add_inodes(struct dquot *dquot, qsize_t inodes,
 	}
 
 	if (dquot->dq_dqb.dqb_isoftlimit &&
-	    newinodes > dquot->dq_dqb.dqb_isoftlimit &&
 	    dquot->dq_dqb.dqb_itime &&
 	    ktime_get_real_seconds() >= dquot->dq_dqb.dqb_itime &&
             !ignore_hardlimit(dquot)) {
@@ -1333,7 +1332,6 @@ static int dquot_add_space(struct dquot *dquot, qsize_t space,
 	}
 
 	if (dquot->dq_dqb.dqb_bsoftlimit &&
-	    tspace > dquot->dq_dqb.dqb_bsoftlimit &&
 	    dquot->dq_dqb.dqb_btime &&
 	    ktime_get_real_seconds() >= dquot->dq_dqb.dqb_btime &&
             !ignore_hardlimit(dquot)) {
Signature · 1 line
2.21.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR