[lustre-devel] [PATCH v3 2/5] staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2

Aya Mahfouz mahfouz.saif.elyazal at gmail.com
Wed Oct 28 17:55:50 PDT 2015


Replaces IS_PO2 by is_power_of_2. It is more accurate to use
is_power_of_2 since it returns 1 for numbers that are powers
of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are
powers of 2.

Reviewed-by: Andreas Dilger <andreas.dilger at intel.com>
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal at gmail.com>
---
v2:
        -changed commit message
	-added Andreas Reviewed by tag
v3:
	-fixed checkpatch.pl warning

 drivers/staging/lustre/lustre/libcfs/hash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c
index 0308744..ec26916 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -109,6 +109,7 @@
 
 #include "../../include/linux/libcfs/libcfs.h"
 #include <linux/seq_file.h>
+#include <linux/log2.h>
 
 #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1
 static unsigned int warn_on_depth = 8;
@@ -1794,7 +1795,7 @@ cfs_hash_rehash_cancel_locked(struct cfs_hash *hs)
 	for (i = 2; cfs_hash_is_rehashing(hs); i++) {
 		cfs_hash_unlock(hs, 1);
 		/* raise console warning while waiting too long */
-		CDEBUG(IS_PO2(i >> 3) ? D_WARNING : D_INFO,
+		CDEBUG(is_power_of_2(i >> 3) ? D_WARNING : D_INFO,
 		       "hash %s is still rehashing, rescheded %d\n",
 		       hs->hs_name, i - 1);
 		cond_resched();
-- 
2.4.2


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz


More information about the lustre-devel mailing list