Remove uses and definition of IS_PO2
v2 cover Remove uses and definition of IS_PO2
Concerned with the removal of IS_PO2 by replacing its uses with is_power_of_2 and then removing the definition.
This is the second version of the patch set. The commit messages were changed and a new patch was added for a use of IS_PO2 indicated by kbuild test robot.
Aya Mahfouz (5):
staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2
staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2
staging: lustre: workitem.c: replace IS_PO2 by is_power_of_2
staging: lustre: selftest.h: replace IS_PO2 by is_power_of_2
staging: lustre: libcfs.h: remove IS_PO2 and __is_po2
drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 ------- drivers/staging/lustre/lnet/selftest/selftest.h | 4 +++- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 5 ++++- drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- drivers/staging/lustre/lustre/libcfs/workitem.c | 4 +++- 5 files changed, 13 insertions(+), 11 deletions(-)
Signature · 6 lines
2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH RESEND v2 1/5 staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2
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.
---
v2:
-changed commit message
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +4 -1
@@ -50,6 +50,9 @@*/ #define DEBUG_SUBSYSTEM S_LDLM + +#include <linux/log2.h> +#include "../../include/linux/libcfs/libcfs.h" #include "../include/lustre_dlm.h" #include "../include/obd_support.h"
@@ -149,7 +152,7 @@ static inline int lock_mode_to_index(ldlm_mode_t mode)int index;LASSERT (mode !=0 ); -LASSERT (IS_PO2 (mode)); +LASSERT (is_power_of_2 (mode));for (index =-1 ; mode; index++) mode >>=1 ;LASSERT (index <LCK_MODE_NUM );
Signature · 6 lines
2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH RESEND v2 2/5 staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2
In reply to Aya MahfouzReplaces 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.
---
v2:
-changed commit message
-added Andreas Reviewed by tag
drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/libcfs/hash.c +3 -1
@@ -109,6 +109,8 @@#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 ;
@@ -1785,7 +1787,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 ();
Signature · 6 lines
2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH RESEND v2 2/5 staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2
Quoted 20 lines · Aya Mahfouz
Replaces
IS_PO2byis_power_of_2. It is more accurate to useis_power_of_2since it returns 1 for numbers that are powers of 2 only whereasIS_PO2returns 1 for 0 and numbers that are powers of 2.Reviewed-by Andreas Dilger <[email protected]>Signed-off-by Aya Mahfouz <[email protected]>---
v2:
-changed commit message
-added Andreas Reviewed by tagdrivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/staging/lustre/lustre/libcfs/hash.c +0
-0
drivers/staging/lustre/lustre/libcfs/hash.c line 113
Quoted 5 lines
drivers/staging/lustre/lustre/libcfs/hash.c +2
-0@@ -109,6 +109,8 @@#include "../../include/linux/libcfs/libcfs.h" #include <linux/seq_file.h> +#include <linux/log2.h> +
This extra blank line will introduce new checkpatch error of "multiple blank lines"
regards
sudip
PATCH RESEND v2 2/5 staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2
Quoted 30 lines · Sudip Mukherjee
Quoted 20 lines · Aya Mahfouz
Replaces
IS_PO2byis_power_of_2. It is more accurate to useis_power_of_2since it returns 1 for numbers that are powers of 2 only whereasIS_PO2returns 1 for 0 and numbers that are powers of 2.Reviewed-by Andreas Dilger <[email protected]>Signed-off-by Aya Mahfouz <[email protected]>---
v2:
-changed commit message
-added Andreas Reviewed by tagdrivers/staging/lustre/lustre/libcfs/hash.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/staging/lustre/lustre/libcfs/hash.c +0
-0drivers/staging/lustre/lustre/libcfs/hash.c line 113
Quoted 5 lines
drivers/staging/lustre/lustre/libcfs/hash.c +2
-0@@ -109,6 +109,8 @@#include "../../include/linux/libcfs/libcfs.h" #include <linux/seq_file.h> +#include <linux/log2.h> +This extra blank line will introduce new checkpatch error of "multiple blank lines"
Quoted 2 lines
regards
sudip
Thanks Sudip! I will handle your comments on the patchset and resend it.
Signature · 2 lines
Kind Regards, Aya Saif El-yazal Mahfouz
PATCH RESEND v2 3/5 staging: lustre: workitem.c: replace IS_PO2 by is_power_of_2
In reply to Aya MahfouzReplaces 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.
---
v2:
-changed commit message
-added Andreas Reviewed by tag
drivers/staging/lustre/lustre/libcfs/workitem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/libcfs/workitem.c +3 -1
@@ -41,6 +41,8 @@#define DEBUG_SUBSYSTEM S_LNET +#include <linux/log2.h> +#include "../../include/linux/libcfs/libcfs.h" #define CFS_WS_NAME_LEN 16
@@ -325,7 +327,7 @@ cfs_wi_sched_destroy(struct cfs_wi_sched *sched)spin_lock (&cfs_wi_data.wi_glock);while (sched->ws_nthreads >0 ) { -CDEBUG (IS_PO2 (++i) ?D_WARNING :D_NET , +CDEBUG (is_power_of_2 (++i) ?D_WARNING :D_NET ,"waiting for %d threads of WI sched[%s] to terminate\n" , sched->ws_nthreads, sched->ws_name);
Signature · 6 lines
2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH RESEND v2 4/5 staging: lustre: selftest.h: replace IS_PO2 by is_power_of_2
In reply to Aya MahfouzReplaces 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.
---
v2:
-added new patch in patch set for selftest.h
drivers/staging/lustre/lnet/selftest/selftest.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/lustre/lnet/selftest/selftest.h +3 -1
@@ -43,6 +43,8 @@#define LNET_ONLY +#include <linux/log2.h> +#include "../../include/linux/libcfs/libcfs.h" #include "../../include/linux/lnet/lnet.h" #include "../../include/linux/lnet/lib-lnet.h"
@@ -585,7 +587,7 @@ swi_state2str (int state) do { \ int __I = 2; \ while (!(cond)) { \ - CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ + CDEBUG(is_power_of_2(++__I) ? D_WARNING : D_NET, \ fmt, ## __VA_ARGS__); \ spin_unlock(&(lock)); \ \
Signature · 6 lines
2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH RESEND v2 4/5 staging: lustre: selftest.h: replace IS_PO2 by is_power_of_2
Quoted 27 lines · Aya Mahfouz
Replaces
IS_PO2byis_power_of_2. It is more accurate to useis_power_of_2since it returns 1 for numbers that are powers of 2 only whereasIS_PO2returns 1 for 0 and numbers that are powers of 2.Signed-off-by Aya Mahfouz <[email protected]>---
v2:
-added new patch in patch set forselftest.hdrivers/staging/lustre/lnet/selftest/selftest.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/staging/lustre/lnet/selftest/selftest.h +2
-0@@ -43,6 +43,8 @@#define LNET_ONLY +#include <linux/log2.h> +#include "../../include/linux/libcfs/libcfs.h" #include "../../include/linux/lnet/lnet.h" #include "../../include/linux/lnet/lib-lnet.h"
drivers/staging/lustre/lnet/selftest/selftest.h swi_state2str (int state) · line 590
Quoted 5 lines
drivers/staging/lustre/lnet/selftest/selftest.h +1
-1@@ -585,7 +587,7 @@ swi_state2str (int state) do { \ int __I = 2; \ while (!(cond)) { \ - CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ + CDEBUG(is_power_of_2(++__I) ? D_WARNING : D_NET, \
An extra tab here broke the alignent of those '\'.
regards
sudip
PATCH RESEND v2 5/5 staging: lustre: libcfs.h: remove IS_PO2 and __is_po2
In reply to Aya MahfouzRemoves IS_PO2 and __is_po2 since the uses of IS_PO2 have been replaced by is_power_of_2
---
v2:
-became patch number 5 in the series
drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 ------- 1 file changed, 7 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -7
@@ -42,13 +42,6 @@#include "curproc.h" -static inline int __is_po2 (unsigned long long val) -{ -return !(val & (val -1 )); -} - -#define IS_PO2 (val) __is_po2((unsigned long long)(val)) -#define LOWEST_BIT_SET (x) ((x) & ~((x) - 1))/*
Signature · 6 lines
2.4.2 -- Kind Regards, Aya Saif El-yazal Mahfouz