[Drbd-dev] [PATCH] drbd: drbd_bitmap: Avoid name collision
Fabio Estevam
festevam at gmail.com
Sat Mar 7 19:14:26 CET 2015
From: Fabio Estevam <fabio.estevam at 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 at lixom.net>
Signed-off-by: Fabio Estevam <fabio.estevam at 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
More information about the drbd-dev
mailing list