Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2373694yba; Sat, 27 Apr 2019 22:44:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+lKFZegMZ5ZstnJjbVy6F0JcIVAw967CwBTdz9eN182M3+nE1LC+qik7d2UmNyzBWhTLk X-Received: by 2002:a17:902:9b92:: with SMTP id y18mr46834327plp.187.1556430294573; Sat, 27 Apr 2019 22:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556430294; cv=none; d=google.com; s=arc-20160816; b=VknRXDh/X7WJvTOjQY1xPq3x7TyNSrjaAohNt4cLVtIedbK8XqtPEAH+bzb5FUcyEd jzJ9LppDey70W2GACNRXYT7x3S5hic1LQVLudhoJYtAtizaJzVSR8ozsPoGJs3d0XHuj doYfs1R+akU7s03xGkquGYsIgtmdUilftOLg3+L7yXHXJ9VLHiSG6VFP2rnWw7NX6bom bSx634N60kYfS4hbLwf7HZK7wBw7qKrFZbI/iwXhP83994C7Le/5iAqP/pltzZd6YgHI bwFYf7jC9Tm6nlMaUUtBigu63qJu3PC56ouAtrLFi5W/F/nnP/bRDqFSzVYvXWQeK06w hrFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=nxXDL7lf6WzIZ60mVqUuaMDo3obYI0RkYcQRNEyprgc=; b=bUKiZiYWD+CYdYJCaeD+GMR8pSW4W3jYdn6N8yEnu9dDEqgePVisRiKzggxpXOZi4w aNcfrAmylFHYNao9GGIxuRRcfKMDYcvFBu2na/bmbe4OKvmpBC1+EBSiHilimaNnoKV5 ENuJ3eN5nIICqOVTKn97l4qly0SBDupNIjT0VGDaSXh8Pp5HSkn5J2TxPYRFAaLxSH9n HqVUX1hZlmwwUCgi6oNqITmmMuXvIpCEAb/hmG17QjRnpHAFbSI6Ne1MoxmJ/XRVTa4g kSZfFTVTHpDUJ+P9rbtSOFWQh17UvWPKJvv4iice2iPuOIkhI0oMMzwO1oR8NrnKyLfK oG/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=InzGZlCk; 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 w8si6916563plz.301.2019.04.27.22.43.56; Sat, 27 Apr 2019 22:44:54 -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; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=InzGZlCk; 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 S1726253AbfD1Fke (ORCPT + 99 others); Sun, 28 Apr 2019 01:40:34 -0400 Received: from mout.gmx.net ([212.227.15.15]:55599 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725909AbfD1Fke (ORCPT ); Sun, 28 Apr 2019 01:40:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1556430027; bh=4FSSdG3cyGfUZVzuzJNxiy6EqzS1aYi1gLl02cn+fqI=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=InzGZlCkYrG2YPgikkY9cSoLPCufsc+C0VjMzqTDdTpHKfW2QlXVj+4Czj2SxGkw4 0fhOUr8rzKlkYbVgmT57PLodRur5bzOLbi7pnGNm3rqmsQpE1FbznU3aGITqWTivVF kU5ZtyoPg/lgEVsH8iHxooNAb4C0D+z2Y6qcuXeU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([218.18.229.179]) by mail.gmx.com (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MybKp-1gZE1v0mL7-00z0N8; Sun, 28 Apr 2019 07:40:27 +0200 From: Chengguang Xu To: jack@suse.com Cc: linux-kernel@vger.kernel.org, Chengguang Xu Subject: [PATCH] quota: set init_needed flag only when successfully getting dquot Date: Sun, 28 Apr 2019 13:39:21 +0800 Message-Id: <20190428053921.5984-1-cgxu519@gmx.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:aZAQw7+Ys3uhB5VZD8rZHieigWmpjXU3oczqm8MUmTFRt8BIR+T l0DKFPG+GQ048dBtYqQjU/7NtUlAuGrcTrRNTqKBcSRq0eyLSWPCEJiyEOKvawF0GUXpTdq eSukeYssfa8hWQMsfOuahiFoBTtJ2x4bIm3zJsbfL0d3GumvBy+U+w24+fe4bgtvETgGM2X Z1hgvXu9Hdtc2/mPkugQw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:tklfBWhAadg=:MBCb7WtjmvC5EP46i5K0kR Tl88imlRh/TeCoRw0Fk19e/Y2pJRjOWvhLAflcgIqcp3Erst/EcS628qMs0a5FsVgNlFGItoJ ZxFeTTkNWZK3QLXwaeyBYRga2cgQM/rlN65Oa4Jp+mMJhgcwjfqPxqq5HIsiZWAb8kJyCZy3a 6Or1aECRTZpOZZJXWq67PEMnpTOyVZRoerKDtFhEy+VNobKix1rDqUKpXtbrkNjKwR2ml0ixM kSXn5Sg3TzrxNoNcl6uGZm8SF9eNRKewbNpHNEq4mhiidbhmD88a0k2WhJhzAcc4nh9Rp651P s+UxF0Sb63OY0SHKsrjUCKrSPjoe0CbcgO8FyLVqllyxCl/x/WDe0SRM4nF2EzarXCDIsZUPJ roVEc9mXpCnRDIyjsf/sDqH1tPL4blvsAtUoL5kCSZY6GQMqtBc7dRQQv6k2n3uHXhyCdKXDA xabzaY5pcV0FseKkneWDJQb+EXHcBHKx7QhsPwfnZN8QBwUumi4o8yPR9Zz4DGqCuhlNQ1hKP 311z0HgzOYpMLx1ZgJAHwu+5cVpSD53n76ueu5leVeOGJRDjIHqCcRgDxmoUJeB1ZKiIVdy2T pRpd7N1hpLXaXG+Iqkvw+jJwubXm6JDtv7NC9BBRRr/knSLj7xBcn93RHybSGRwn0dMzaQbA0 QRiLxVVxcHLtvFvo5amfjY7GrHHuCSgaGkllCr6m5cjgHjesfoJSmCzQFf8Bov/xmYA0PB7XE Q7Zxd4yXsMO+DXmshSDt+pveGrtbVBtwwIq5ZH1csarOYHvVs7Ptc72znjEr9LjpC7yIo+Dpj EmKkdEsY6aBVDDYBCDd8sJ7gDdpgnPXBE8ny5qZ4nWjsqNbNgG83gLdoGGeC+5WEnZGyZaFfg HC+qYp8ZfpUUEhvaIWBAVtuTskGIZ8ChwYTlLYDDKNSYLIoXVaGaGkzxhoqwHI Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set init_needed flag only when successfully getting dquot, so that we can skip unnecessary subsequent operation. Signed-off-by: Chengguang Xu =2D-- 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 =2D-- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1449,8 +1449,6 @@ static int __dquot_initialize(struct inode *inode, i= nt type) if (!sb_has_quota_active(sb, cnt)) continue; - init_needed =3D 1; - switch (cnt) { case USRQUOTA: qid =3D make_kqid_uid(inode->i_uid); @@ -1475,6 +1473,9 @@ static int __dquot_initialize(struct inode *inode, i= nt type) dquot =3D NULL; } got[cnt] =3D dquot; + + if (got[cnt]) + init_needed =3D 1; } /* All required i_dquot has been initialized */ =2D- 2.20.1