Re: [PATCH v3 1/4] ida: Add ida_find_first_range()

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

 



On Thu, Sep 12, 2024 at 06:17:26AM -0700, Yi Liu wrote:
> There is no helpers for user to check if a given ID is allocated or not,
> neither a helper to loop all the allocated IDs in an IDA and do something
> for cleanup. With the two needs, a helper to get the lowest allocated ID
> of a range and two variants based on it.
> 
> Caller can check if a given ID is allocated or not by:
> 
> 	bool ida_exists(struct ida *ida, unsigned int id)
> 
> Caller can iterate all allocated IDs by:
> 
> 	int id;
> 	while ((id = ida_find_first(&pasid_ida)) > 0) {
> 		//anything to do with the allocated ID
> 		ida_free(pasid_ida, pasid);
> 	}
> 
> Cc: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
> Suggested-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Signed-off-by: Yi Liu <yi.l.liu@xxxxxxxxx>
> ---
>  include/linux/idr.h | 11 ++++++++
>  lib/idr.c           | 67 +++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 78 insertions(+)

No test cases for the test suite?  ;-(




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux