Re: [PATCH v2 4/8] vfio: Remove vfio_external_group_match_file()

Yi Liu
2022-04-21T14:51:59Z

On 2022/4/21 03:23, Jason Gunthorpe wrote:
> vfio_group_fops_open() ensures there is only ever one struct file open for
> any struct vfio_group at any time:
>
> /* Do we need multiple instances of the group open? Seems not. */
> opened = atomic_cmpxchg(&group->opened, 0, 1);
> if (opened) {
> vfio_group_put(group);
> return -EBUSY;
>
> Therefor the struct file * can be used directly to search the list of VFIO
> groups that KVM keeps instead of using the
> vfio_external_group_match_file() callback to try to figure out if the
> passed in FD matches the list or not.
>
> Delete vfio_external_group_match_file().
>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> drivers/vfio/vfio.c | 9 ---------
> include/linux/vfio.h | 2 --
> virt/kvm/vfio.c | 19 +------------------
> 3 files changed, 1 insertion(+), 29 deletions(-)

Reviewed-by: Yi Liu <yi.l.liu@intel.com>

--
Regards,
Yi Liu