All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] quota: set init_needed flag only when successfully getting dquot
@ 2019-04-28  5:39 Chengguang Xu
  2019-04-29 21:49 ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Chengguang Xu @ 2019-04-28  5:39 UTC (permalink / raw)
  To: jack; +Cc: linux-kernel, Chengguang Xu

Set init_needed flag only when successfully getting dquot,
so that we can skip unnecessary subsequent operation.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 fs/quota/dquot.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index fc20e06c56ba..8d4ce2a2b5c8 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1449,8 +1449,6 @@ static int __dquot_initialize(struct inode *inode, int type)
 		if (!sb_has_quota_active(sb, cnt))
 			continue;

-		init_needed = 1;
-
 		switch (cnt) {
 		case USRQUOTA:
 			qid = make_kqid_uid(inode->i_uid);
@@ -1475,6 +1473,9 @@ static int __dquot_initialize(struct inode *inode, int type)
 			dquot = NULL;
 		}
 		got[cnt] = dquot;
+
+		if (got[cnt])
+			init_needed = 1;
 	}

 	/* All required i_dquot has been initialized */
--
2.20.1


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

* Re: [PATCH] quota: set init_needed flag only when successfully getting dquot
  2019-04-28  5:39 [PATCH] quota: set init_needed flag only when successfully getting dquot Chengguang Xu
@ 2019-04-29 21:49 ` Jan Kara
  2019-04-30  2:27   ` cgxu519
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2019-04-29 21:49 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: jack, linux-kernel

On Sun 28-04-19 13:39:21, Chengguang Xu wrote:
> Set init_needed flag only when successfully getting dquot,
> so that we can skip unnecessary subsequent operation.
> 
> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>

Thanks for the patch but I don't think it's really useful. It will be very
rare that we race with quotaoff of dqget() fails due to error. So the
additional overhead of iterating over dquots doesn't really matter in that
case.

								Honza

> ---
>  fs/quota/dquot.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index fc20e06c56ba..8d4ce2a2b5c8 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -1449,8 +1449,6 @@ static int __dquot_initialize(struct inode *inode, int type)
>  		if (!sb_has_quota_active(sb, cnt))
>  			continue;
> 
> -		init_needed = 1;
> -
>  		switch (cnt) {
>  		case USRQUOTA:
>  			qid = make_kqid_uid(inode->i_uid);
> @@ -1475,6 +1473,9 @@ static int __dquot_initialize(struct inode *inode, int type)
>  			dquot = NULL;
>  		}
>  		got[cnt] = dquot;
> +
> +		if (got[cnt])
> +			init_needed = 1;
>  	}
> 
>  	/* All required i_dquot has been initialized */
> --
> 2.20.1
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

* Re: [PATCH] quota: set init_needed flag only when successfully getting dquot
  2019-04-29 21:49 ` Jan Kara
@ 2019-04-30  2:27   ` cgxu519
  0 siblings, 0 replies; 3+ messages in thread
From: cgxu519 @ 2019-04-30  2:27 UTC (permalink / raw)
  To: Jan Kara; +Cc: jack, linux-kernel

On 4/30/19 5:49 AM, Jan Kara wrote:
> On Sun 28-04-19 13:39:21, Chengguang Xu wrote:
>> Set init_needed flag only when successfully getting dquot,
>> so that we can skip unnecessary subsequent operation.
>>
>> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
> Thanks for the patch but I don't think it's really useful. It will be very
> rare that we race with quotaoff of dqget() fails due to error. So the
> additional overhead of iterating over dquots doesn't really matter in that
> case.

Hi Jan,

Thanks for the comment, I got it.

Chengguang.


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

end of thread, other threads:[~2019-04-30  2:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-28  5:39 [PATCH] quota: set init_needed flag only when successfully getting dquot Chengguang Xu
2019-04-29 21:49 ` Jan Kara
2019-04-30  2:27   ` cgxu519

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.