ocfs2/dlm: Move BITS_TO_BYTES() to bitops.h for wider use
Subsystems (5)
PATCH 1/1 ocfs2/dlm: Move BITS_TO_BYTES() to bitops.h for wider use
There are users already and will be more of BITS_TO_BYTES() macro. Move it to bitops.h for wider use.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h | 1 - fs/ocfs2/dlm/dlmcommon.h | 4 ---- include/linux/bitops.h | 1 + 3 files changed, 1 insertion(+), 5 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h +0 -1
@@ -296,7 +296,6 @@ static inline void bnx2x_dcb_config_qm(struct bnx2x *bp, enum cos_mode mode,* possible, the driver should only write the valid vnics into the internal * ram according to the appropriate port mode. */ -#define BITS_TO_BYTES (x) ((x)/8)/* CMNG constants, as derived from system spec calculations */
fs/ocfs2/dlm/dlmcommon.h +0 -4
@@ -688,10 +688,6 @@ struct dlm_begin_reco__be32 pad2; }; - -#define BITS_PER_BYTE 8 -#define BITS_TO_BYTES (bits) (((bits)+BITS_PER_BYTE-1)/BITS_PER_BYTE) -struct dlm_query_join_request {u8 node_idx;
include/linux/bitops.h +1 -0
@@ -5,6 +5,7 @@#include <linux/bits.h> #define BITS_PER_TYPE (type) (sizeof(type) * BITS_PER_BYTE) +#define BITS_TO_BYTES (nr) DIV_ROUND_UP(nr, BITS_PER_BYTE)#define BITS_TO_LONGS (nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))extern unsigned int __sw_hweight8 (unsigned int w);
Signature · 1 line
2.23.0.rc1
Quoted 15 lines · Andy Shevchenko
There are users already and will be more of
BITS_TO_BYTES()macro. Move it tobitops.hfor wider use.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h | 1 - fs/ocfs2/dlm/dlmcommon.h | 4 ---- include/linux/bitops.h | 1 + 3 files changed, 1 insertion(+), 5 deletions(-)drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h +0
-0
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h static inline void bnx2x_dcb_config_qm(struct bnx2x *bp, enum cos_mode mode, · line 299
Quoted 4 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h +0
-1@@ -296,7 +296,6 @@ static inline void bnx2x_dcb_config_qm(struct bnx2x *bp, enum cos_mode mode,* possible, the driver should only write the valid vnics into the internal * ram according to the appropriate port mode. */ -#define BITS_TO_BYTES (x) ((x)/8)>
I don't think this is a equivalent replace, or it is in fact wrong before?
Quoted 7 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h +0
-0/* CMNG constants, as derived from system spec calculations */ fs/ocfs2/dlm/dlmcommon.h +0
-0
fs/ocfs2/dlm/dlmcommon.h struct dlm_begin_reco · line 694
Quoted 7 lines
fs/ocfs2/dlm/dlmcommon.h +0
-4@@ -688,10 +688,6 @@ struct dlm_begin_reco__be32 pad2; }; - -#define BITS_PER_BYTE 8 -#define BITS_TO_BYTES (bits) (((bits)+BITS_PER_BYTE-1)/BITS_PER_BYTE) -
For ocfs2 part, it looks good to me.
Quoted 16 lines
fs/ocfs2/dlm/dlmcommon.h +0
-0struct dlm_query_join_request {u8 node_idx;include/linux/bitops.h +1
-0@@ -5,6 +5,7 @@#include <linux/bits.h> #define BITS_PER_TYPE (type) (sizeof(type) * BITS_PER_BYTE) +#define BITS_TO_BYTES (nr) DIV_ROUND_UP(nr, BITS_PER_BYTE)#define BITS_TO_LONGS (nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))extern unsigned int __sw_hweight8 (unsigned int w);
Quoted 11 lines · Joseph Qi
Quoted 10 lines · Andy Shevchenko
There are users already and will be more of
BITS_TO_BYTES()macro. Move it tobitops.hfor wider use.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h | 1 - fs/ocfs2/dlm/dlmcommon.h | 4 ---- include/linux/bitops.h | 1 + 3 files changed, 1 insertion(+), 5 deletions(-)
Quoted 11 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h static inline void bnx2x_dcb_config_qm(struct bnx2x *bp, enum cos_mode mode, · line 299
Quoted 9 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h +0
-1@@ -296,7 +296,6 @@ static inline void bnx2x_dcb_config_qm(struct bnx2x *bp, enum cos_mode mode,* possible, the driver should only write the valid vnics into the internal * ram according to the appropriate port mode. */ -#define BITS_TO_BYTES (x) ((x)/8)>I don't think this is a equivalent replace, or it is in fact wrong before?
I was thinking about this one and there are two applications:
- calculus of the amount of structures of certain type per PAGE (obviously off-by-one error in the original code IIUC purpose of STRUCT_SIZE)
- calculus of some threshold based on line speed in bytes per second (I dunno it will have any difference on the Gbs / 100 MBs speeds)
Quoted 10 lines
Quoted 10 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h +0
-0/* CMNG constants, as derived from system spec calculations */ fs/ocfs2/dlm/dlmcommon.h +0
-0@@ -688,10 +688,6 @@ struct dlm_begin_reco__be32 pad2; };
Quoted 6 lines
fs/ocfs2/dlm/dlmcommon.h struct dlm_begin_reco · line 694
Quoted 4 lines
fs/ocfs2/dlm/dlmcommon.h +0
-4- -#define BITS_PER_BYTE 8 -#define BITS_TO_BYTES (bits) (((bits)+BITS_PER_BYTE-1)/BITS_PER_BYTE) -For ocfs2 part, it looks good to me.
Reviewed-by Joseph Qi <[email protected]>
Thanks!
Quoted 17 lines
Quoted 17 lines
fs/ocfs2/dlm/dlmcommon.h +0
-0struct dlm_query_join_request {u8 node_idx;include/linux/bitops.h +1
-0@@ -5,6 +5,7 @@#include <linux/bits.h> #define BITS_PER_TYPE (type) (sizeof(type) * BITS_PER_BYTE) +#define BITS_TO_BYTES (nr) DIV_ROUND_UP(nr, BITS_PER_BYTE)#define BITS_TO_LONGS (nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))extern unsigned int __sw_hweight8 (unsigned int w);
Signature · 2 lines
With Best Regards, Andy Shevchenko
Sudarsana Reddy Kalluru
maintainerQuoted 40 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Andy Shevchenko
Sent: Wednesday, August 21, 2019 2:56 PM
To: Joseph Qi <[email protected]>
Cc: Mark Fasheh <[email protected]>; Joel Becker <[email protected]>; [email protected]; Ariel Elior <[email protected]>; Sudarsana Reddy Kalluru <[email protected]>; GR-everest-linux-l2 <GR-everest- [email protected]>; David S. Miller <[email protected]>; [email protected]; Colin Ian King <[email protected]>
Subject: Re: [PATCH v1] ocfs2/dlm: MoveBITS_TO_BYTES()tobitops.hfor wider useQuoted 11 lines · Joseph Qi
Quoted 10 lines · Andy Shevchenko
There are users already and will be more of
BITS_TO_BYTES()macro. Move it tobitops.hfor wider use.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h | 1 - fs/ocfs2/dlm/dlmcommon.h | 4 ---- include/linux/bitops.h | 1 + 3 files changed, 1 insertion(+), 5 deletions(-)Quoted 6 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h static inline void bnx2x_dcb_config_qm(struct
Quoted 6 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h +0
-0@@ -296,7 +296,6 @@ static inline void bnx2x_dcb_config_qm(structbnx2x *bp, enum
cos_modemode,Quoted 6 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h static inline void bnx2x_dcb_config_qm(struct bnx2x *bp, enum cos_mode mode,
Quoted 4 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h +0
-1* possible, the driver should only write the valid vnics into the internal * ram according to the appropriate port mode. */ -#define BITS_TO_BYTES (x) ((x)/8)>I don't think this is a equivalent replace, or it is in fact wrong before?
Quoted 7 lines
I was thinking about this one and there are two applications:
- calculus of the amount of structures of certain type per PAGE (obviously off-by-one error in the original code IIUC purpose ofSTRUCT_SIZE)
- calculus of some threshold based on line speed in bytes per second (I dunno it will have any difference on the Gbs / 100 MBs speeds)
I see that both the implementations (existing vs new) yield same value for standard speeds 10G (i.e.,10000), 1G (1000) that device supports. Hence the change look to be ok.
Quoted 43 lines
Quoted 10 lines
Quoted 10 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_init.h +0
-0/* CMNG constants, as derived from system spec calculations */ fs/ocfs2/dlm/dlmcommon.h +0
-0@@ -688,10 +688,6 @@ struct dlm_begin_reco__be32 pad2; };Quoted 7 lines
fs/ocfs2/dlm/dlmcommon.h struct dlm_begin_reco · line 694
Quoted 5 lines
fs/ocfs2/dlm/dlmcommon.h +0
-4- -#define BITS_PER_BYTE 8 -#define BITS_TO_BYTES (bits) (((bits)+BITS_PER_BYTE -1 )/BITS_PER_BYTE ) -For ocfs2 part, it looks good to me.
Reviewed-by Joseph Qi <[email protected]>Thanks!
Quoted 11 lines
Quoted 11 lines
fs/ocfs2/dlm/dlmcommon.h +0
-0struct dlm_query_join_request {fs/ocfs2/dlm/dlmcommon.h +0
-0u8 node_idx;include/linux/bitops.h index renamed from include/linux/bitops.h +0
-0
cf074bce3eb3..79d80f5ddf7b100644include/linux/bitops.h +0
-0@@ -5,6 +5,7 @@#include <linux/bits.h> Quoted 3 lines
include/linux/bitops.h
Quoted 3 lines
include/linux/bitops.h +1
-0#define BITS_PER_TYPE (type) (sizeof(type) * BITS_PER_BYTE) +#define BITS_TO_BYTES (nr) DIV_ROUND_UP(nr, BITS_PER_BYTE)#define BITS_TO_LONGS (nr) DIV_ROUND_UP(nr,
BITS_PER_TYPE(long))Quoted 3 lines
include/linux/bitops.h line 11
Quoted 3 lines
include/linux/bitops.h +0
-0extern unsigned int __sw_hweight8 (unsigned int w);--
With Best Regards,
Andy Shevchenko
Quoted 23 lines · Sudarsana Reddy Kalluru
Quoted 23 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Andy Shevchenko
Sent: Wednesday, August 21, 2019 2:56 PM
To: Joseph Qi <[email protected]>
Cc: Mark Fasheh <[email protected]>; Joel Becker <[email protected]>; [email protected]; Ariel Elior <[email protected]>; Sudarsana Reddy Kalluru <[email protected]>; GR-everest-linux-l2 <GR-everest- [email protected]>; David S. Miller <[email protected]>; [email protected]; Colin Ian King <[email protected]>
Subject: Re: [PATCH v1] ocfs2/dlm: MoveBITS_TO_BYTES()tobitops.hfor wider useQuoted 7 lines · Joseph Qi
Quoted 4 lines · Andy Shevchenko
There are users already and will be more of
BITS_TO_BYTES()macro. Move it tobitops.hfor wider use.-#define
BITS_TO_BYTES(x)((x)/8)>I don't think this is a equivalent replace, or it is in fact wrong before?
Quoted 8 lines
Quoted 7 lines
I was thinking about this one and there are two applications:
- calculus of the amount of structures of certain type per PAGE (obviously off-by-one error in the original code IIUC purpose ofSTRUCT_SIZE)
- calculus of some threshold based on line speed in bytes per second (I dunno it will have any difference on the Gbs / 100 MBs speeds)I see that both the implementations (existing vs new) yield same value for standard speeds 10G (i.e.,10000), 1G (1000) that device supports. Hence the change look to be ok.
Thank you for testing, may I use your Tested-by tag?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Sudarsana Reddy Kalluru
maintainerQuoted 47 lines
-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Thursday, August 22, 2019 2:39 PM
To: Sudarsana Reddy Kalluru <[email protected]>
Cc: Joseph Qi <[email protected]>; Mark Fasheh <[email protected]>; Joel Becker <[email protected]>; ocfs2- [email protected]; Ariel Elior <[email protected]>; GR-everest-linux-l2 <[email protected]>; David S. Miller <[email protected]>; [email protected]; Colin Ian King <[email protected]>
Subject: Re: [PATCH v1] ocfs2/dlm: MoveBITS_TO_BYTES()tobitops.hfor wider useQuoted 3 lines · Sudarsana Reddy Kalluru
Quoted 3 lines
-----Original Message-----
From: [email protected] <[email protected]>On
Quoted 28 lines
Quoted 28 lines
Behalf Of Andy Shevchenko
Sent: Wednesday, August 21, 2019 2:56 PM
To: Joseph Qi <[email protected]>
Cc: Mark Fasheh <[email protected]>; Joel Becker <[email protected]>; [email protected]; Ariel Elior <[email protected]>; Sudarsana Reddy Kalluru <[email protected]>; GR-everest-linux-l2 <GR-everest- [email protected]>; David S. Miller <[email protected]>; [email protected]; Colin Ian King <[email protected]>
Subject: Re: [PATCH v1] ocfs2/dlm: MoveBITS_TO_BYTES()tobitops.hfor wider useQuoted 7 lines · Joseph Qi
Quoted 4 lines · Andy Shevchenko
There are users already and will be more of
BITS_TO_BYTES()macro. Move it tobitops.hfor wider use.-#define
BITS_TO_BYTES(x)((x)/8)>I don't think this is a equivalent replace, or it is in fact wrong before?
I was thinking about this one and there are two applications:
- calculus of the amount of structures of certain type per PAGE (obviously off-by-one error in the original code IIUC purpose ofSTRUCT_SIZE)
- calculus of some threshold based on line speed in bytes per second (I dunno it will have any difference on the Gbs / 100 MBs speeds)
Quoted 5 lines
Quoted 1 line
I see that both the implementations (existing vs new) yield same value for
standard speeds 10G (i.e.,10000), 1G (1000) that device supports. Hence the change look to be ok.
Thank you for testing, may I use your Tested-by tag?
Sorry, I didn't test the actual driver flows. Was only referring to the output values for 1000/10000 speed values.
Quoted 5 lines
--
With Best Regards,
Andy Shevchenko