* [Drbd-dev] [PATCH] drbd: drbd_bitmap: Avoid name collision
@ 2015-03-07 18:14 Fabio Estevam
2015-03-10 10:54 ` [Drbd-dev] [DRBD-user] " Lars Ellenberg
0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2015-03-07 18:14 UTC (permalink / raw)
To: drbd-dev; +Cc: Fabio Estevam, drbd-user
From: Fabio Estevam <fabio.estevam@freescale.com>
Building for ARM64 leads to the following build warnings:
CC drivers/block/drbd/drbd_bitmap.o
drivers/block/drbd/drbd_bitmap.c:483:0: warning: "BITS_PER_PAGE" redefined
#define BITS_PER_PAGE (1UL << (PAGE_SHIFT + 3))
^
In file included from include/linux/ptrace.h:8:0,
from ./arch/arm64/include/asm/compat.h:26,
from ./arch/arm64/include/asm/stat.h:23,
from include/linux/stat.h:5,
from include/linux/sysfs.h:21,
from include/linux/kobject.h:21,
from include/linux/device.h:17,
from include/linux/pm_qos.h:10,
from include/linux/netdevice.h:28,
from include/net/sock.h:51,
from include/linux/connector.h:30,
from include/linux/drbd.h:28,
from drivers/block/drbd/drbd_bitmap.c:30:
include/linux/pid_namespace.h:18:0: note: this is the location of the previous definition
#define BITS_PER_PAGE (PAGE_SIZE * 8)
^
drivers/block/drbd/drbd_bitmap.c:484:0: warning: "BITS_PER_PAGE_MASK" redefined
#define BITS_PER_PAGE_MASK (BITS_PER_PAGE - 1)
^
In file included from include/linux/ptrace.h:8:0,
from ./arch/arm64/include/asm/compat.h:26,
from ./arch/arm64/include/asm/stat.h:23,
from include/linux/stat.h:5,
from include/linux/sysfs.h:21,
from include/linux/kobject.h:21,
from include/linux/device.h:17,
from include/linux/pm_qos.h:10,
from include/linux/netdevice.h:28,
from include/net/sock.h:51,
from include/linux/connector.h:30,
from include/linux/drbd.h:28,
from drivers/block/drbd/drbd_bitmap.c:30:
include/linux/pid_namespace.h:19:0: note: this is the location of the previous definition
#define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1)
^
Fix the warnings by using BITS_PER_PAGE_DRBD and BITS_PER_PAGE_MASK_DRBD
definitions to avoid the name collision.
Reported-by: Olof's autobuilder <build@lixom.net>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/block/drbd/drbd_bitmap.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c
index 434c77d..b8dc9fc 100644
--- a/drivers/block/drbd/drbd_bitmap.c
+++ b/drivers/block/drbd/drbd_bitmap.c
@@ -479,8 +479,8 @@ void drbd_bm_cleanup(struct drbd_device *device)
* this masks out the remaining bits.
* Returns the number of bits cleared.
*/
-#define BITS_PER_PAGE (1UL << (PAGE_SHIFT + 3))
-#define BITS_PER_PAGE_MASK (BITS_PER_PAGE - 1)
+#define BITS_PER_PAGE_DRBD (1UL << (PAGE_SHIFT + 3))
+#define BITS_PER_PAGE_MASK_DRBD (BITS_PER_PAGE_DRBD - 1)
#define BITS_PER_LONG_MASK (BITS_PER_LONG - 1)
static int bm_clear_surplus(struct drbd_bitmap *b)
{
@@ -490,7 +490,7 @@ static int bm_clear_surplus(struct drbd_bitmap *b)
int cleared = 0;
/* number of bits modulo bits per page */
- tmp = (b->bm_bits & BITS_PER_PAGE_MASK);
+ tmp = (b->bm_bits & BITS_PER_PAGE_MASK_DRBD);
/* mask the used bits of the word containing the last bit */
mask = (1UL << (tmp & BITS_PER_LONG_MASK)) -1;
/* bitmap is always stored little endian,
@@ -526,7 +526,7 @@ static void bm_set_surplus(struct drbd_bitmap *b)
int tmp;
/* number of bits modulo bits per page */
- tmp = (b->bm_bits & BITS_PER_PAGE_MASK);
+ tmp = (b->bm_bits & BITS_PER_PAGE_MASK_DRBD);
/* mask the used bits of the word containing the last bit */
mask = (1UL << (tmp & BITS_PER_LONG_MASK)) -1;
/* bitmap is always stored little endian,
@@ -570,7 +570,7 @@ static unsigned long bm_count_bits(struct drbd_bitmap *b)
cond_resched();
}
/* last (or only) page */
- last_word = ((b->bm_bits - 1) & BITS_PER_PAGE_MASK) >> LN2_BPL;
+ last_word = ((b->bm_bits - 1) & BITS_PER_PAGE_MASK_DRBD) >> LN2_BPL;
p_addr = __bm_map_pidx(b, idx);
for (i = 0; i < last_word; i++)
bits += hweight_long(p_addr[i]);
@@ -1257,15 +1257,15 @@ static unsigned long __bm_find_next(struct drbd_device *device, unsigned long bm
} else {
while (bm_fo < b->bm_bits) {
/* bit offset of the first bit in the page */
- bit_offset = bm_fo & ~BITS_PER_PAGE_MASK;
+ bit_offset = bm_fo & ~BITS_PER_PAGE_MASK_DRBD;
p_addr = __bm_map_pidx(b, bm_bit_to_page_idx(b, bm_fo));
if (find_zero_bit)
i = find_next_zero_bit_le(p_addr,
- PAGE_SIZE*8, bm_fo & BITS_PER_PAGE_MASK);
+ PAGE_SIZE*8, bm_fo & BITS_PER_PAGE_MASK_DRBD);
else
i = find_next_bit_le(p_addr,
- PAGE_SIZE*8, bm_fo & BITS_PER_PAGE_MASK);
+ PAGE_SIZE*8, bm_fo & BITS_PER_PAGE_MASK_DRBD);
__bm_unmap(p_addr);
if (i < PAGE_SIZE*8) {
@@ -1366,9 +1366,9 @@ static int __bm_change_bits_to(struct drbd_device *device, const unsigned long s
last_page_nr = page_nr;
}
if (val)
- c += (0 == __test_and_set_bit_le(bitnr & BITS_PER_PAGE_MASK, p_addr));
+ c += (0 == __test_and_set_bit_le(bitnr & BITS_PER_PAGE_MASK_DRBD, p_addr));
else
- c -= (0 != __test_and_clear_bit_le(bitnr & BITS_PER_PAGE_MASK, p_addr));
+ c -= (0 != __test_and_clear_bit_le(bitnr & BITS_PER_PAGE_MASK_DRBD, p_addr));
}
if (p_addr)
__bm_unmap(p_addr);
@@ -1545,7 +1545,7 @@ int drbd_bm_test_bit(struct drbd_device *device, const unsigned long bitnr)
bm_print_lock_info(device);
if (bitnr < b->bm_bits) {
p_addr = bm_map_pidx(b, bm_bit_to_page_idx(b, bitnr));
- i = test_bit_le(bitnr & BITS_PER_PAGE_MASK, p_addr) ? 1 : 0;
+ i = test_bit_le(bitnr & BITS_PER_PAGE_MASK_DRBD, p_addr) ? 1 : 0;
bm_unmap(p_addr);
} else if (bitnr == b->bm_bits) {
i = -1;
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Drbd-dev] [DRBD-user] [PATCH] drbd: drbd_bitmap: Avoid name collision
2015-03-07 18:14 [Drbd-dev] [PATCH] drbd: drbd_bitmap: Avoid name collision Fabio Estevam
@ 2015-03-10 10:54 ` Lars Ellenberg
2015-03-10 16:06 ` Fabio Estevam
0 siblings, 1 reply; 3+ messages in thread
From: Lars Ellenberg @ 2015-03-10 10:54 UTC (permalink / raw)
To: Fabio Estevam; +Cc: Fabio Estevam, drbd-dev
On Sat, Mar 07, 2015 at 03:14:26PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Building for ARM64 leads to the following build warnings:
>
> CC drivers/block/drbd/drbd_bitmap.o
> drivers/block/drbd/drbd_bitmap.c:483:0: warning: "BITS_PER_PAGE" redefined
> #define BITS_PER_PAGE (1UL << (PAGE_SHIFT + 3))
Apparently there are more than one consumer of "BITS_PER_PAGE".
The commit that moved the now conflicting definition to pid_namespace.h
itself already refered to a similar "redefined" warning.
Would it not make more sense to have one such definition next to PAGE_SIZE?
Or somewhere central, anyways?
> Fix the warnings by using BITS_PER_PAGE_DRBD and BITS_PER_PAGE_MASK_DRBD
> definitions to avoid the name collision.
Other than that:
Ack.
Lars Ellenberg
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Drbd-dev] [DRBD-user] [PATCH] drbd: drbd_bitmap: Avoid name collision
2015-03-10 10:54 ` [Drbd-dev] [DRBD-user] " Lars Ellenberg
@ 2015-03-10 16:06 ` Fabio Estevam
0 siblings, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2015-03-10 16:06 UTC (permalink / raw)
To: Fabio Estevam, drbd-dev, Fabio Estevam
On Tue, Mar 10, 2015 at 7:54 AM, Lars Ellenberg
<lars.ellenberg@linbit.com> wrote:
> Apparently there are more than one consumer of "BITS_PER_PAGE".
> The commit that moved the now conflicting definition to pid_namespace.h
> itself already refered to a similar "redefined" warning.
>
> Would it not make more sense to have one such definition next to PAGE_SIZE?
> Or somewhere central, anyways?
What about this instead?
--- a/drivers/block/drbd/drbd_bitmap.c
+++ b/drivers/block/drbd/drbd_bitmap.c
@@ -29,6 +29,7 @@
#include <linux/string.h>
#include <linux/drbd.h>
#include <linux/slab.h>
+#include <linux/pid_namespace.h>
#include <asm/kmap_types.h>
#include "drbd_int.h"
@@ -479,8 +480,6 @@ void drbd_bm_cleanup(struct drbd_device *device)
* this masks out the remaining bits.
* Returns the number of bits cleared.
*/
-#define BITS_PER_PAGE (1UL << (PAGE_SHIFT + 3))
-#define BITS_PER_PAGE_MASK (BITS_PER_PAGE - 1)
#define BITS_PER_LONG_MASK (BITS_PER_LONG - 1)
static int bm_clear_surplus(struct drbd_bitmap *b)
{
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-12 23:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-07 18:14 [Drbd-dev] [PATCH] drbd: drbd_bitmap: Avoid name collision Fabio Estevam
2015-03-10 10:54 ` [Drbd-dev] [DRBD-user] " Lars Ellenberg
2015-03-10 16:06 ` Fabio Estevam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox