Re: idr_get_new_exact ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/20/2010 02:31 PM, Andrew Morton wrote:
On Mon, 20 Sep 2010 16:11:31 +0200
Ohad Ben-Cohen<ohad@xxxxxxxxxx>  wrote:

Occasionally, drivers care about the value that idr associates with
their pointers.

Today we have idr_get_new_above() which allocates a new idr entry
above or equal to a given starting id, but sometimes drivers need to
force an exact value.

To overcome this small API gap, drivers are wrapping idr_get_new_above
and then either BUG_ON() or just call idr_remove() and returns -EBUSY
when idr allocates them an id which is different than their requested
value.

There are only a handful of users who need this (see below. especially
note the i2c comment :), but it might be nice to have such an API (a
bit less of code, and a bit less error prone).

Would something like the below be desirable/acceptable ?
It seems OK to me - it's an improvement over what we have now.


Looks ok to me also. This is exactly what cxgb* needs. IE the driver manages the ID space and never expects an idr insertion to fail because its already inserted. That constitutes a driver bug (which is why the BUG_ON() is there :)).

Steve.

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux