Re: [PATCH 02/19] kernel: add bl_list

From: Nick Piggin
Date: Sat Oct 16 2010 - 05:52:06 EST


On Sat, Oct 16, 2010 at 07:13:56PM +1100, Dave Chinner wrote:
> From: Nick Piggin <npiggin@xxxxxxx>
> +/**
> + * hlist_bl_lock - lock a hash list
> + * @h: hash list head to lock
> + */
> +static inline void hlist_bl_lock(struct hlist_bl_head *h)
> +{
> + bit_spin_lock(0, (unsigned long *)h);
> +}
> +
> +/**
> + * hlist_bl_unlock - unlock a hash list
> + * @h: hash list head to unlock
> + */
> +static inline void hlist_bl_unlock(struct hlist_bl_head *h)
> +{
> + __bit_spin_unlock(0, (unsigned long *)h);
> +}

I don't know why Christoph asked for these; he's usually against
obfuscating wrapper functions.

bit_spin_lock is fine in callers so please leave it at that.
Other users may not want a spinlock, or might want to use
bit_spin_is_locked, bit_spin_trylock etc.


> diff --git a/include/linux/poison.h b/include/linux/poison.h
> index 2110a81..d367d39 100644
> --- a/include/linux/poison.h
> +++ b/include/linux/poison.h
> @@ -22,6 +22,8 @@
> #define LIST_POISON1 ((void *) 0x00100100 + POISON_POINTER_DELTA)
> #define LIST_POISON2 ((void *) 0x00200200 + POISON_POINTER_DELTA)
>
> +#define BL_LIST_POISON1 ((void *) 0x00300300 + POISON_POINTER_DELTA)
> +#define BL_LIST_POISON2 ((void *) 0x00400400 + POISON_POINTER_DELTA)
> /********** include/linux/timer.h **********/
> /*
> * Magic number "tsta" to indicate a static timer initializer

I don't see the point of this, but if there is one it should be
documented in a different patch and propagated to other types of
lists too. I wouldn't worry about it though.

--
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/