[dm-devel] Re: [PATCH] 1/1: Device-Mapper: Remove 1024 devices limitation
akpm at osdl.org
Fri Jul 2 19:42:18 UTC 2004
Kevin Corry <kevcorry at us.ibm.com> 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.
More information about the dm-devel