Re: [PATCH 03/12] DRBD: bitmap

From: Nikanth K
Date: Wed Apr 08 2009 - 06:16:33 EST


On Mon, Mar 23, 2009 at 9:17 PM, Philipp Reisner
<philipp.reisner@xxxxxxxxxx> wrote:
> +/* definition of bits in bm_flags */
> +#define BM_LOCKED 0
> +#define BM_MD_IO_ERROR (BITS_PER_LONG-1) /* 31? 63? */

Wonder whether this should be made same for 32-bit as well as 64-bit?
Especially for x86_64 as the machine can become 32-bit to 64-bit or
vice-versa after reboot.


<snip>

> +#if 0
> +#define catch_oob_access_start() do { Â\
> + Â Â Â do { Â Â Â Â Â Â Â Â Â Â Â Â Â Â\
> + Â Â Â Â Â Â Â if ((bm-p_addr) >= PAGE_SIZE/sizeof(long)) { \
> + Â Â Â Â Â Â Â Â Â Â Â printk(KERN_ALERT "drbd_bitmap.c:%u %s: p_addr:%p bm:%p %d\n", \
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â __LINE__ , __func__ , p_addr, bm, (bm-p_addr)); \
> + Â Â Â Â Â Â Â Â Â Â Â break; Â Â Â Â Â\
> + Â Â Â Â Â Â Â }
> +#define catch_oob_access_end() \
> + Â Â Â } while (0); } while (0)
> +#else
> +#define catch_oob_access_start() do {
> +#define catch_oob_access_end() } while (0)
> +#endif
> +


Probably should be changed to be based on a config debug option?

<snip>

> +/*
> + * since (b->bm_bits % BITS_PER_LONG) != 0,
> + * this masks out the remaining bits.
> + * Rerturns the number of bits cleared.
> + */
> +STATIC int bm_clear_surplus(struct drbd_bitmap *b)
> +{
> + Â Â Â const unsigned long mask = (1UL << (b->bm_bits & (BITS_PER_LONG-1))) - 1;

Should BM_MD_IO_ERROR be used instead of (BITS_PER_LONG-1)?
Or at least this deserves a macro as it is used in many places.


Thanks
Nikanth
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/