iommufd/iova_bitmap: Move initial pinning to iova_bitmap_for_each()
The pinned pages are only relevant when it starts iterating the bitmap so defer that into iova_bitmap_for_each(). Link: https://lore.kernel.org/r/20240627110105.62325-9-joao.m.martins@oracle.com Signed-off-by: Joao Martins <joao.m.martins@oracle.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Tested-by: Matt Ochs <mochs@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
committed by
Jason Gunthorpe
parent
a84c690e10
commit
781bc08797
@@ -269,9 +269,6 @@ struct iova_bitmap *iova_bitmap_alloc(unsigned long iova, size_t length,
|
||||
goto err;
|
||||
}
|
||||
|
||||
rc = iova_bitmap_get(bitmap);
|
||||
if (rc)
|
||||
goto err;
|
||||
return bitmap;
|
||||
|
||||
err:
|
||||
@@ -425,6 +422,10 @@ int iova_bitmap_for_each(struct iova_bitmap *bitmap, void *opaque,
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = iova_bitmap_get(bitmap);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
for (; !iova_bitmap_done(bitmap) && !ret;
|
||||
ret = iova_bitmap_advance(bitmap)) {
|
||||
ret = fn(bitmap, iova_bitmap_mapped_iova(bitmap),
|
||||
|
||||
Reference in New Issue
Block a user