Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 29 Oct 2002 12:36:04 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 29 Oct 2002 12:36:04 -0500 Received: from leibniz.math.psu.edu ([146.186.130.2]:48881 "EHLO math.psu.edu") by vger.kernel.org with ESMTP id ; Tue, 29 Oct 2002 12:36:03 -0500 Date: Tue, 29 Oct 2002 12:42:24 -0500 (EST) From: Alexander Viro To: Joe Thornber cc: Linus Torvalds , Linux Mailing List Subject: Re: [PATCH] dm update 3/3 In-Reply-To: <20021029172016.GC1779@fib011235813.fsnet.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 706 Lines: 26 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/