lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20200621053100.11713-1-cgxu519@mykernel.net>
Date:   Sun, 21 Jun 2020 13:31:00 +0800
From:   Chengguang Xu <cgxu519@...ernel.net>
To:     jack@...e.com
Cc:     linux-kernel@...r.kernel.org, Chengguang Xu <cgxu519@...ernel.net>
Subject: [PATCH] quota: minor optimization for __dquot_initialize()

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 <cgxu519@...ernel.net>
---
 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ