Re: [PATCH] dm update 3/3

From: Alexander Viro (viro@math.psu.edu)
Date: Tue Oct 29 2002 - 12:42:24 EST


On Tue, 29 Oct 2002, Joe Thornber wrote:

> Keep track of allocated minors in a bitset rather than abusing
> get_gendisk.
 
> + spin_lock(&_minor_lock);
> + for (i = 0; i < MAX_DEVICES; i++) {
> + if (!test_bit(i, _minor_bits)) {
> + r = i;
> + set_bit(i, _minor_bits);
> DMWARN("allocating minor = %d", i);
> - return i;
> + break;
> }
> + }
> + spin_unlock(&_minor_lock);

Ugh. See find_first_zero_bit() - no need to reinvent that wheel...

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



This archive was generated by hypermail 2b29 : Thu Oct 31 2002 - 22:00:43 EST