summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@zoho.com.cn>2019-09-23 21:52:23 +0800
committerJan Kara <jack@suse.cz>2019-10-04 10:11:46 +0200
commit24fc755f56b15bf3215c0d0b8b62d7204f369bab (patch)
treea043892763ab6763c4ed065dbee8fa6dd193313a /fs
parent05848db2083d4f232e84e385845dcd98d5c511b2 (diff)
downloadlinux-stable-24fc755f56b15bf3215c0d0b8b62d7204f369bab.tar.gz
linux-stable-24fc755f56b15bf3215c0d0b8b62d7204f369bab.tar.bz2
linux-stable-24fc755f56b15bf3215c0d0b8b62d7204f369bab.zip
quota: code cleanup for hash bits calculation
Code cleanup for hash bits calculation by calling ilog2(). Link: https://lore.kernel.org/r/20190923135223.27674-1-cgxu519@zoho.com.cn Signed-off-by: Chengguang Xu <cgxu519@zoho.com.cn> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r--fs/quota/dquot.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 00a3c6df2ea3..26812a67ed77 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2981,11 +2981,7 @@ static int __init dquot_init(void)
/* Find power-of-two hlist_heads which can fit into allocation */
nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct hlist_head);
- dq_hash_bits = 0;
- do {
- dq_hash_bits++;
- } while (nr_hash >> dq_hash_bits);
- dq_hash_bits--;
+ dq_hash_bits = ilog2(nr_hash);
nr_hash = 1UL << dq_hash_bits;
dq_hash_mask = nr_hash - 1;