Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4159917yba; Mon, 29 Apr 2019 14:52:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7nfONmvSbJeArXpmGSMtEQWCTaF4CGaOp3k8foOoUj5CqXNsyuu8WcATvmOfBCsDIZJxF X-Received: by 2002:a17:902:f24:: with SMTP id 33mr57963643ply.44.1556574764067; Mon, 29 Apr 2019 14:52:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556574764; cv=none; d=google.com; s=arc-20160816; b=xgxhxDPN2hGsWCEFNg3vPw0gGEHZI0paDyal439u6H0qpO6gTAauNeGYdBY6qsJ+BW YkDwhfRNzWJVi1XYHpW8ecOZYQEth8Qu6LMkTZUOvc9mbgQkVVcYles+ieJnDwo8HpIM ITqCg6LZYTcEvzg0tjo5HDu5ykDRMsFw8InDSOkmxgxGEvCU/+YmHRGFZT1Rkwok10By R95lZTLVxpeoRc1D4PVuCavKXdyKPTpVafNpB23T4SBubFxySAK3EoIGjRCVcF6Kwutf J17qe6cbyTj9wON2I4j5S+bNc1lvASX1l2sT3MYqRJc/QIiOo7Qvxud9wQLAokmxNhXL 1BZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=66v+wB3qw4E5ZReIg1ACAAFou7XmZQ+u2PyE35kmXg8=; b=XRS0CwisIpvAyxzhJNRKRTu4TTvIACZUh9BEBRQhtCEZpnjgnTw10I1eWJYhPs/RPm 7yrUB1XZihZIF4uykDuxh2L6luMh82TWOVEyDGEyIGIB5RlxWFPkYJiliCyUllo8vmf4 uuleOf2Ijz9KGlqQYoZ/AP0cAOpV4aCy9xbg4lFI3nssGokGVwaKsISWSA5qghPWGcmm r177RqrmJMpgFft/5cqzWNiLpUvNHjMavpIeeweWOR5qvDyoHooNb9ZIaUNEvtKOh9+9 YKZ4AdRU/hFSONlJxpGhCIR459TLz7FWlGrD2b//Kp/4ZLiEXTQoNY0mX6DL5yujX3RC S3hw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e14si16716746pgm.340.2019.04.29.14.52.28; Mon, 29 Apr 2019 14:52:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729499AbfD2Vt6 (ORCPT + 99 others); Mon, 29 Apr 2019 17:49:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:53844 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729368AbfD2Vt6 (ORCPT ); Mon, 29 Apr 2019 17:49:58 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6C907ABD7; Mon, 29 Apr 2019 21:49:57 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 124071E3BEC; Mon, 29 Apr 2019 23:49:56 +0200 (CEST) Date: Mon, 29 Apr 2019 23:49:56 +0200 From: Jan Kara To: Chengguang Xu Cc: jack@suse.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] quota: set init_needed flag only when successfully getting dquot Message-ID: <20190429214956.GA6740@quack2.suse.cz> References: <20190428053921.5984-1-cgxu519@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190428053921.5984-1-cgxu519@gmx.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 SUSE Labs, CR