Skip to content

Commit 781bc08

Browse files
jpemartinsjgunthorpe
authored andcommitted
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/[email protected] Signed-off-by: Joao Martins <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Tested-by: Matt Ochs <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent a84c690 commit 781bc08

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/iommu/iommufd/iova_bitmap.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,6 @@ struct iova_bitmap *iova_bitmap_alloc(unsigned long iova, size_t length,
269269
goto err;
270270
}
271271

272-
rc = iova_bitmap_get(bitmap);
273-
if (rc)
274-
goto err;
275272
return bitmap;
276273

277274
err:
@@ -425,6 +422,10 @@ int iova_bitmap_for_each(struct iova_bitmap *bitmap, void *opaque,
425422
{
426423
int ret = 0;
427424

425+
ret = iova_bitmap_get(bitmap);
426+
if (ret)
427+
return ret;
428+
428429
for (; !iova_bitmap_done(bitmap) && !ret;
429430
ret = iova_bitmap_advance(bitmap)) {
430431
ret = fn(bitmap, iova_bitmap_mapped_iova(bitmap),

0 commit comments

Comments
 (0)