All of lore.kernel.org
 help / color / mirror / Atom feed
* [lustre-devel] [PATCH v3 0/5] Remove uses and definition of IS_PO2
@ 2015-10-29  0:52 Aya Mahfouz
  2015-10-29  0:54 ` [lustre-devel] [PATCH v3 1/5] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 Aya Mahfouz
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Aya Mahfouz @ 2015-10-29  0:52 UTC (permalink / raw)
  To: lustre-devel

Concerned with the removal of IS_PO2 by replacing its uses
with is_power_of_2 and then removing the definition.

The second version handled warnings indicated by kbuild test robot.
The third version handled checkpatch.pl warnings indicated by Sudip
Mukherjee.

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      | 2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c     | 2 +-
 drivers/staging/lustre/lustre/libcfs/hash.c          | 3 ++-
 drivers/staging/lustre/lustre/libcfs/workitem.c      | 2 +-
 5 files changed, 5 insertions(+), 11 deletions(-)

-- 
2.4.2


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [lustre-devel] [PATCH v3 1/5] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2
  2015-10-29  0:52 [lustre-devel] [PATCH v3 0/5] Remove uses and definition of IS_PO2 Aya Mahfouz
@ 2015-10-29  0:54 ` Aya Mahfouz
  2015-10-29  0:55 ` [lustre-devel] [PATCH v3 2/5] staging: lustre: hash.c: Replace " Aya Mahfouz
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Aya Mahfouz @ 2015-10-29  0:54 UTC (permalink / raw)
  To: lustre-devel

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.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
v2:
        -changed commit message
v3:
	-no change

 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
index c787888..9c70f31 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
@@ -149,7 +149,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);
-- 
2.4.2


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [lustre-devel] [PATCH v3 2/5] staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2
  2015-10-29  0:52 [lustre-devel] [PATCH v3 0/5] Remove uses and definition of IS_PO2 Aya Mahfouz
  2015-10-29  0:54 ` [lustre-devel] [PATCH v3 1/5] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 Aya Mahfouz
@ 2015-10-29  0:55 ` Aya Mahfouz
  2015-11-07  1:10   ` Greg KH
  2015-10-29  0:57 ` [lustre-devel] [PATCH v3 3/5] staging: lustre: workitem.c: replace " Aya Mahfouz
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Aya Mahfouz @ 2015-10-29  0:55 UTC (permalink / raw)
  To: lustre-devel

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@intel.com>
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [lustre-devel] [PATCH v3 3/5] staging: lustre: workitem.c: replace IS_PO2 by is_power_of_2
  2015-10-29  0:52 [lustre-devel] [PATCH v3 0/5] Remove uses and definition of IS_PO2 Aya Mahfouz
  2015-10-29  0:54 ` [lustre-devel] [PATCH v3 1/5] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 Aya Mahfouz
  2015-10-29  0:55 ` [lustre-devel] [PATCH v3 2/5] staging: lustre: hash.c: Replace " Aya Mahfouz
@ 2015-10-29  0:57 ` Aya Mahfouz
  2015-10-29  0:59 ` [lustre-devel] [PATCH v3 4/5] staging: lustre: selftest.h: " Aya Mahfouz
  2015-10-29  1:00 ` [lustre-devel] [PATCH v3 5/5] staging: lustre: libcfs.h: remove IS_PO2 and __is_po2 Aya Mahfouz
  4 siblings, 0 replies; 9+ messages in thread
From: Aya Mahfouz @ 2015-10-29  0:57 UTC (permalink / raw)
  To: lustre-devel

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@intel.com>
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
v2:
        -changed commit message
	-added Andreas Reviewed by tag
v3:
	-no change

 drivers/staging/lustre/lustre/libcfs/workitem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c
index e1143a5..268dd68 100644
--- a/drivers/staging/lustre/lustre/libcfs/workitem.c
+++ b/drivers/staging/lustre/lustre/libcfs/workitem.c
@@ -325,7 +325,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);
 
-- 
2.4.2


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [lustre-devel] [PATCH v3 4/5] staging: lustre: selftest.h: replace IS_PO2 by is_power_of_2
  2015-10-29  0:52 [lustre-devel] [PATCH v3 0/5] Remove uses and definition of IS_PO2 Aya Mahfouz
                   ` (2 preceding siblings ...)
  2015-10-29  0:57 ` [lustre-devel] [PATCH v3 3/5] staging: lustre: workitem.c: replace " Aya Mahfouz
@ 2015-10-29  0:59 ` Aya Mahfouz
  2015-10-29  1:00 ` [lustre-devel] [PATCH v3 5/5] staging: lustre: libcfs.h: remove IS_PO2 and __is_po2 Aya Mahfouz
  4 siblings, 0 replies; 9+ messages in thread
From: Aya Mahfouz @ 2015-10-29  0:59 UTC (permalink / raw)
  To: lustre-devel

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.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
v2:
        -added new patch in patch set for selftest.h
v3:
	-fixed checkpatch.pl warning

 drivers/staging/lustre/lnet/selftest/selftest.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h
index 8a77d3f..15b3b34 100644
--- a/drivers/staging/lustre/lnet/selftest/selftest.h
+++ b/drivers/staging/lustre/lnet/selftest/selftest.h
@@ -585,7 +585,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));					\
 									\
-- 
2.4.2


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [lustre-devel] [PATCH v3 5/5] staging: lustre: libcfs.h: remove IS_PO2 and __is_po2
  2015-10-29  0:52 [lustre-devel] [PATCH v3 0/5] Remove uses and definition of IS_PO2 Aya Mahfouz
                   ` (3 preceding siblings ...)
  2015-10-29  0:59 ` [lustre-devel] [PATCH v3 4/5] staging: lustre: selftest.h: " Aya Mahfouz
@ 2015-10-29  1:00 ` Aya Mahfouz
  2015-11-07  1:11   ` Greg KH
  4 siblings, 1 reply; 9+ messages in thread
From: Aya Mahfouz @ 2015-10-29  1:00 UTC (permalink / raw)
  To: lustre-devel

Removes IS_PO2 and __is_po2 since the uses of IS_PO2 have
been replaced by is_power_of_2

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
v2:
        -became patch number 5 in the series
v3:
	-no change

 drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index 4d74e8a..7f76b20 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -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))
 
 /*
-- 
2.4.2


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [lustre-devel] [PATCH v3 2/5] staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2
  2015-10-29  0:55 ` [lustre-devel] [PATCH v3 2/5] staging: lustre: hash.c: Replace " Aya Mahfouz
@ 2015-11-07  1:10   ` Greg KH
  0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2015-11-07  1:10 UTC (permalink / raw)
  To: lustre-devel

On Thu, Oct 29, 2015 at 02:55:50AM +0200, Aya Mahfouz wrote:
> 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@intel.com>
> Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@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(-)

This doesn't apply to my tree, can you please refresh it and resend?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [lustre-devel] [PATCH v3 5/5] staging: lustre: libcfs.h: remove IS_PO2 and __is_po2
  2015-10-29  1:00 ` [lustre-devel] [PATCH v3 5/5] staging: lustre: libcfs.h: remove IS_PO2 and __is_po2 Aya Mahfouz
@ 2015-11-07  1:11   ` Greg KH
  2015-11-07 10:03     ` Aya Mahfouz
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2015-11-07  1:11 UTC (permalink / raw)
  To: lustre-devel

On Thu, Oct 29, 2015 at 03:00:24AM +0200, Aya Mahfouz wrote:
> Removes IS_PO2 and __is_po2 since the uses of IS_PO2 have
> been replaced by is_power_of_2
> 
> Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> ---
> v2:
>         -became patch number 5 in the series
> v3:
> 	-no change
> 
>  drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 -------
>  1 file changed, 7 deletions(-)

I can't take this yet, as your patch 2/5 didn't apply :(

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [lustre-devel] [PATCH v3 5/5] staging: lustre: libcfs.h: remove IS_PO2 and __is_po2
  2015-11-07  1:11   ` Greg KH
@ 2015-11-07 10:03     ` Aya Mahfouz
  0 siblings, 0 replies; 9+ messages in thread
From: Aya Mahfouz @ 2015-11-07 10:03 UTC (permalink / raw)
  To: lustre-devel

On Fri, Nov 06, 2015 at 05:11:09PM -0800, Greg KH wrote:
> On Thu, Oct 29, 2015 at 03:00:24AM +0200, Aya Mahfouz wrote:
> > Removes IS_PO2 and __is_po2 since the uses of IS_PO2 have
> > been replaced by is_power_of_2
> > 
> > Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> > ---
> > v2:
> >         -became patch number 5 in the series
> > v3:
> > 	-no change
> > 
> >  drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 -------
> >  1 file changed, 7 deletions(-)
> 
> I can't take this yet, as your patch 2/5 didn't apply :(

No, problems. I understand that it is hard for these patches to apply as
is given that they are quite old. I will recheck if there are new uses
of them and resend this patch alone or in another patchset.

Thanks,

-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-11-07 10:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-29  0:52 [lustre-devel] [PATCH v3 0/5] Remove uses and definition of IS_PO2 Aya Mahfouz
2015-10-29  0:54 ` [lustre-devel] [PATCH v3 1/5] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 Aya Mahfouz
2015-10-29  0:55 ` [lustre-devel] [PATCH v3 2/5] staging: lustre: hash.c: Replace " Aya Mahfouz
2015-11-07  1:10   ` Greg KH
2015-10-29  0:57 ` [lustre-devel] [PATCH v3 3/5] staging: lustre: workitem.c: replace " Aya Mahfouz
2015-10-29  0:59 ` [lustre-devel] [PATCH v3 4/5] staging: lustre: selftest.h: " Aya Mahfouz
2015-10-29  1:00 ` [lustre-devel] [PATCH v3 5/5] staging: lustre: libcfs.h: remove IS_PO2 and __is_po2 Aya Mahfouz
2015-11-07  1:11   ` Greg KH
2015-11-07 10:03     ` Aya Mahfouz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.