All of lore.kernel.org
 help / color / mirror / Atom feed
* [lustre-devel] [RESEND PATCH v2 0/5] Remove uses and definition of IS_PO2
@ 2015-10-27 17:41 Aya Mahfouz
  2015-10-27 17:42 ` [lustre-devel] [RESEND PATCH v2 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-27 17:41 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.

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(-)

-- 
2.4.2


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

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

* [lustre-devel] [RESEND PATCH v2 1/5] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2
  2015-10-27 17:41 [lustre-devel] [RESEND PATCH v2 0/5] Remove uses and definition of IS_PO2 Aya Mahfouz
@ 2015-10-27 17:42 ` Aya Mahfouz
  2015-10-27 17:43 ` [lustre-devel] [RESEND PATCH v2 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-27 17:42 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

 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

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

* [lustre-devel] [RESEND PATCH v2 2/5] staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2
  2015-10-27 17:41 [lustre-devel] [RESEND PATCH v2 0/5] Remove uses and definition of IS_PO2 Aya Mahfouz
  2015-10-27 17:42 ` [lustre-devel] [RESEND PATCH v2 1/5] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 Aya Mahfouz
@ 2015-10-27 17:43 ` Aya Mahfouz
  2015-10-28  6:41   ` Sudip Mukherjee
  2015-10-27 17:44 ` [lustre-devel] [RESEND PATCH v2 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-27 17:43 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

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

diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c
index 6f4c7d4..4b5e79a 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -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();
-- 
2.4.2


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

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

* [lustre-devel] [RESEND PATCH v2 3/5] staging: lustre: workitem.c: replace IS_PO2 by is_power_of_2
  2015-10-27 17:41 [lustre-devel] [RESEND PATCH v2 0/5] Remove uses and definition of IS_PO2 Aya Mahfouz
  2015-10-27 17:42 ` [lustre-devel] [RESEND PATCH v2 1/5] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 Aya Mahfouz
  2015-10-27 17:43 ` [lustre-devel] [RESEND PATCH v2 2/5] staging: lustre: hash.c: Replace " Aya Mahfouz
@ 2015-10-27 17:44 ` Aya Mahfouz
  2015-10-27 17:45 ` [lustre-devel] [RESEND PATCH v2 4/5] staging: lustre: selftest.h: " Aya Mahfouz
  2015-10-27 17:46 ` [lustre-devel] [RESEND PATCH v2 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-27 17:44 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

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

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


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

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

* [lustre-devel] [RESEND PATCH v2 4/5] staging: lustre: selftest.h: replace IS_PO2 by is_power_of_2
  2015-10-27 17:41 [lustre-devel] [RESEND PATCH v2 0/5] Remove uses and definition of IS_PO2 Aya Mahfouz
                   ` (2 preceding siblings ...)
  2015-10-27 17:44 ` [lustre-devel] [RESEND PATCH v2 3/5] staging: lustre: workitem.c: replace " Aya Mahfouz
@ 2015-10-27 17:45 ` Aya Mahfouz
  2015-10-28  6:44   ` Sudip Mukherjee
  2015-10-27 17:46 ` [lustre-devel] [RESEND PATCH v2 5/5] staging: lustre: libcfs.h: remove IS_PO2 and __is_po2 Aya Mahfouz
  4 siblings, 1 reply; 9+ messages in thread
From: Aya Mahfouz @ 2015-10-27 17:45 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

 drivers/staging/lustre/lnet/selftest/selftest.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

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

* [lustre-devel] [RESEND PATCH v2 5/5] staging: lustre: libcfs.h: remove IS_PO2 and __is_po2
  2015-10-27 17:41 [lustre-devel] [RESEND PATCH v2 0/5] Remove uses and definition of IS_PO2 Aya Mahfouz
                   ` (3 preceding siblings ...)
  2015-10-27 17:45 ` [lustre-devel] [RESEND PATCH v2 4/5] staging: lustre: selftest.h: " Aya Mahfouz
@ 2015-10-27 17:46 ` Aya Mahfouz
  4 siblings, 0 replies; 9+ messages in thread
From: Aya Mahfouz @ 2015-10-27 17:46 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

 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] [RESEND PATCH v2 2/5] staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2
  2015-10-27 17:43 ` [lustre-devel] [RESEND PATCH v2 2/5] staging: lustre: hash.c: Replace " Aya Mahfouz
@ 2015-10-28  6:41   ` Sudip Mukherjee
  2015-10-29  0:26     ` Aya Mahfouz
  0 siblings, 1 reply; 9+ messages in thread
From: Sudip Mukherjee @ 2015-10-28  6:41 UTC (permalink / raw)
  To: lustre-devel

On Tue, Oct 27, 2015 at 07:43:34PM +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
> 
>  drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c
> index 6f4c7d4..4b5e79a 100644
> --- a/drivers/staging/lustre/lustre/libcfs/hash.c
> +++ b/drivers/staging/lustre/lustre/libcfs/hash.c
> @@ -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

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

* [lustre-devel] [RESEND PATCH v2 4/5] staging: lustre: selftest.h: replace IS_PO2 by is_power_of_2
  2015-10-27 17:45 ` [lustre-devel] [RESEND PATCH v2 4/5] staging: lustre: selftest.h: " Aya Mahfouz
@ 2015-10-28  6:44   ` Sudip Mukherjee
  0 siblings, 0 replies; 9+ messages in thread
From: Sudip Mukherjee @ 2015-10-28  6:44 UTC (permalink / raw)
  To: lustre-devel

On Tue, Oct 27, 2015 at 07:45:22PM +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.
> 
> Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> ---
> 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(-)
> 
> diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h
> index 8a77d3f..2846f26 100644
> --- a/drivers/staging/lustre/lnet/selftest/selftest.h
> +++ b/drivers/staging/lustre/lnet/selftest/selftest.h
> @@ -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,		\

An extra tab here broke the alignent of those '\'.

regards
sudip

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

* [lustre-devel] [RESEND PATCH v2 2/5] staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2
  2015-10-28  6:41   ` Sudip Mukherjee
@ 2015-10-29  0:26     ` Aya Mahfouz
  0 siblings, 0 replies; 9+ messages in thread
From: Aya Mahfouz @ 2015-10-29  0:26 UTC (permalink / raw)
  To: lustre-devel

On Wed, Oct 28, 2015 at 12:11:59PM +0530, Sudip Mukherjee wrote:
> On Tue, Oct 27, 2015 at 07:43:34PM +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
> > 
> >  drivers/staging/lustre/lustre/libcfs/hash.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c
> > index 6f4c7d4..4b5e79a 100644
> > --- a/drivers/staging/lustre/lustre/libcfs/hash.c
> > +++ b/drivers/staging/lustre/lustre/libcfs/hash.c
> > @@ -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
Thanks Sudip! I will handle your comments on the patchset and resend it.

-- 
Kind Regards,
Aya Saif El-yazal Mahfouz

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

end of thread, other threads:[~2015-10-29  0:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-27 17:41 [lustre-devel] [RESEND PATCH v2 0/5] Remove uses and definition of IS_PO2 Aya Mahfouz
2015-10-27 17:42 ` [lustre-devel] [RESEND PATCH v2 1/5] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 Aya Mahfouz
2015-10-27 17:43 ` [lustre-devel] [RESEND PATCH v2 2/5] staging: lustre: hash.c: Replace " Aya Mahfouz
2015-10-28  6:41   ` Sudip Mukherjee
2015-10-29  0:26     ` Aya Mahfouz
2015-10-27 17:44 ` [lustre-devel] [RESEND PATCH v2 3/5] staging: lustre: workitem.c: replace " Aya Mahfouz
2015-10-27 17:45 ` [lustre-devel] [RESEND PATCH v2 4/5] staging: lustre: selftest.h: " Aya Mahfouz
2015-10-28  6:44   ` Sudip Mukherjee
2015-10-27 17:46 ` [lustre-devel] [RESEND PATCH v2 5/5] staging: lustre: libcfs.h: remove IS_PO2 and __is_po2 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.