Re: [PATCH] 1/1: Device-Mapper: Remove 1024 devices limitation

From: Andrew Morton
Date: Fri Jul 02 2004 - 14:44:09 EST


Kevin Corry <kevcorry@xxxxxxxxxx> wrote:
>
> > Yes, idr is the one to use. That linear search you have in there becomes
> > logarithmic. Will speed up the registration of 100,000 minors no end ;)
>
> I've got a patch that switches from a bit-set to an IDR structure. The only
> thing I'm slightly uncertain about is the case where we're trying to create
> a device with a specific minor number (when creating a DM device, you have
> the choice to specify a minor number or have DM find the first available
> one). To do this, I call idr_find() with the desired minor. If that returns
> NULL (meaning it's not already in use), then I call idr_get_new_above() with
> that same desired minor. In the cases I've tested, this always chooses the
> desired minor, but can we depend on that behavior?

Yes, that has to work - you're holding the lock throughout.

It would be sensible to make that a part of the idr API 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/