linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] quota: remove unnecessary check in dquot_add_inodes() and dquot_add_space()
@ 2019-11-17 13:20 Chengguang Xu
  2019-11-19 16:03 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Chengguang Xu @ 2019-11-17 13:20 UTC (permalink / raw)
  To: jack; +Cc: linux-kernel, 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.

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
 fs/quota/dquot.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 6e826b454082..97740077afac 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -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)) {
-- 
2.21.0




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] quota: remove unnecessary check in dquot_add_inodes() and dquot_add_space()
  2019-11-17 13:20 [PATCH] quota: remove unnecessary check in dquot_add_inodes() and dquot_add_space() Chengguang Xu
@ 2019-11-19 16:03 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2019-11-19 16:03 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: jack, linux-kernel

On Sun 17-11-19 21:20:28, Chengguang Xu wrote:
> After passed grace time we treat softlimit as hardlimit,
> so we don't have to compare desire usage with softlimit
> in this place.
> 
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>

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

> ---
>  fs/quota/dquot.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index 6e826b454082..97740077afac 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -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)) {
> -- 
> 2.21.0
> 
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-19 16:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-17 13:20 [PATCH] quota: remove unnecessary check in dquot_add_inodes() and dquot_add_space() Chengguang Xu
2019-11-19 16:03 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).