Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1784615ybt; Sat, 20 Jun 2020 22:49:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNTEhjeOvObvCuGPP6ayvVCuZg23wGFocGGwxops7xMqs6YBz61LbU1GnrdnO9QLJ1TXsz X-Received: by 2002:a17:906:3154:: with SMTP id e20mr10914641eje.171.1592718564755; Sat, 20 Jun 2020 22:49:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1592718564; cv=pass; d=google.com; s=arc-20160816; b=Cv8EiWcYGwmseBbwYynoZKHXhZGPeJw/oxIMIM+hHcXsdDZonKVgSA/p0QDYp1vwDj 18/zrf8/k3yqI8Bk9aWzRTy/gugtDgLvLqZji1Xc3tOcH988uijFdtkKjyRumG71pOtz uq4jIHrCEnYJGb/DyweN7VzscypRW6L+JaL/DinsKJZUkySwjh2hh6pWKTUVyKMbPtOR 0mMiiJexTAQZDIR0/ohyXpQxrv0I85cVkTTKUqqbGxCZr29R8ff6QtsvrHKdHoVlBnHX 4b+EbWZmSSMT8Kr0/B0rdGWcxmxjRJrxce5VPC28OqEvjDDMerXLkbABuxkh/+E2zoCp PUpg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=ncGOVGTvVXr8HQdPUjbtNc/ZzWf+9iRtPISZt83WDGs=; b=PlzFPDOWBBfWCD2hclBELjGRb78D6D1XJiauy4+WYRErmKHCjhdfuLnOhfXJM0VLOt ggIo0HaIiSw6QCl7dBaSWCcb6BMjTupa0Lcq7g7G7NDppX2YOZbEw+M+ReZCjoU6+8CM SidgdliPbTyNKIwjQnZBQiqIfrjkQdxMSi2SlaZFPQbU/8TFP29L8X2dUxDaf2OrwmAT w1fHu2KwRED+G5uL1OuodfNP6bQNp69gFtPuiD2UQZyHBaSIGSa+mxjB8xqVNWTWaXbp I0xmKjCVQNfpEk4J7lA2LNO3HbWAq5i7co/MwUZfwrmhMuOvI/MzBaDqXJSldlGwdDvB moIA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=MmB9gFrM; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zp8si480836ejb.255.2020.06.20.22.49.02; Sat, 20 Jun 2020 22:49:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=MmB9gFrM; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729313AbgFUFq1 (ORCPT + 99 others); Sun, 21 Jun 2020 01:46:27 -0400 Received: from sender2-op-o12.zoho.com.cn ([163.53.93.243]:17185 "EHLO sender2-op-o12.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725928AbgFUFq1 (ORCPT ); Sun, 21 Jun 2020 01:46:27 -0400 X-Greylist: delayed 910 seconds by postgrey-1.27 at vger.kernel.org; Sun, 21 Jun 2020 01:46:26 EDT ARC-Seal: i=1; a=rsa-sha256; t=1592717468; cv=none; d=zoho.com.cn; s=zohoarc; b=PG+gT53m50blBYBKu3rXvb37BnPHGejAeXguu4NXFnNPFA29XvBNQg0+50YhPyTFf4yN9Pwo4XW+uPOY3aIDP5VHAHxNY81L2ReQkWi+EeNWrqGI+41/YT15bohADHuqftapMtHafLeVYP42DlpaNe8HXeL+PtxRIwEQ15sSK9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1592717468; h=Cc:Date:From:Message-ID:Subject:To; bh=ncGOVGTvVXr8HQdPUjbtNc/ZzWf+9iRtPISZt83WDGs=; b=fgNoZzFZERJ2+LwtzhV+fUP1IQApZfJGFiPfTzI4IV2oUzfR5tzTHzgrD6aOecKFGiSiCw7hGozR+7mYfFejm1THGsKc0ehcHYXc9bbnmPxfP3isXCYg6RNZ5Bh+iG/7G/Qr9IhqA6+1F4B0Royv5eK67cZyAorifNCVg7CRfo8= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=mykernel.net; spf=pass smtp.mailfrom=cgxu519@mykernel.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1592717468; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:To:Cc:Subject:Date:Message-Id; bh=ncGOVGTvVXr8HQdPUjbtNc/ZzWf+9iRtPISZt83WDGs=; b=MmB9gFrMT+YbnSW1Qt/ADDSaHZABafbFcKGO0aMC1cDWGGV5lRezItHATGoZ2K5g OuwnU+ujAWa/sxxZhoX/UAdUs40yHH2VarLNWm7JjQarQDL3Vs2ze0FjfWwds8St9MI c3GAjwEXZVo7o1GKhFfl/Ubywhe9xc4qs0HToelg= Received: from localhost.localdomain (113.87.91.105 [113.87.91.105]) by mx.zoho.com.cn with SMTPS id 1592717466309467.4152727314364; Sun, 21 Jun 2020 13:31:06 +0800 (CST) From: Chengguang Xu To: jack@suse.com Cc: linux-kernel@vger.kernel.org, Chengguang Xu Subject: [PATCH] quota: minor optimization for __dquot_initialize() Date: Sun, 21 Jun 2020 13:31:00 +0800 Message-Id: <20200621053100.11713-1-cgxu519@mykernel.net> X-Mailer: git-send-email 2.17.2 X-ZohoCNMailClient: External Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Count the number of quotas which are needed to initialize, instead of just setting to 1 so that we may avoid unnecessary process in special case. Signed-off-by: Chengguang Xu --- fs/quota/dquot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 7b4bac91146b..f93bd60c3998 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1459,7 +1459,7 @@ static int __dquot_initialize(struct inode *inode, int type) if (!sb_has_quota_active(sb, cnt)) continue; - init_needed = 1; + init_needed++; switch (cnt) { case USRQUOTA: @@ -1483,6 +1483,7 @@ static int __dquot_initialize(struct inode *inode, int type) goto out_put; } dquot = NULL; + init_needed--; } got[cnt] = dquot; } -- 2.17.2