[PATCH] dcookies.c: code cleanup for hash_bits calculation in dcookie_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Code cleanup for hash_bits calculation by calling
ilog2() in dcookie_init().

Signed-off-by: Chengguang Xu <cgxu519@xxxxxxxxxxx>
---
 fs/dcookies.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/dcookies.c b/fs/dcookies.c
index 6eeb61100a09..4c3253926b55 100644
--- a/fs/dcookies.c
+++ b/fs/dcookies.c
@@ -245,11 +245,7 @@ static int dcookie_init(void)
 	 * a power-of-two.
 	 */
 	hash_size = PAGE_SIZE / sizeof(struct list_head);
-	hash_bits = 0;
-	do {
-		hash_bits++;
-	} while ((hash_size >> hash_bits) != 0);
-	hash_bits--;
+	hash_bits = ilog2(hash_size);
 
 	/*
 	 * Re-calculate the actual number of entries and the mask
-- 
2.20.1






[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux