]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
vfio/pci: drop nth_page() usage within SG entry
authorDavid Hildenbrand <david@redhat.com>
Mon, 1 Sep 2025 15:03:53 +0000 (17:03 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:25:37 +0000 (17:25 -0700)
It's no longer required to use nth_page() when iterating pages within a
single SG entry, so let's drop the nth_page() usage.

Link: https://lkml.kernel.org/r/20250901150359.867252-33-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Yishai Hadas <yishaih@nvidia.com>
Cc: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Cc: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/vfio/pci/pds/lm.c
drivers/vfio/pci/virtio/migrate.c

index f2673d395236a27b02a624daa589262afb9d15ca..4d70c833fa32e30070e56b99b797ed42e9b4a371 100644 (file)
@@ -151,8 +151,7 @@ static struct page *pds_vfio_get_file_page(struct pds_vfio_lm_file *lm_file,
                        lm_file->last_offset_sg = sg;
                        lm_file->sg_last_entry += i;
                        lm_file->last_offset = cur_offset;
-                       return nth_page(sg_page(sg),
-                                       (offset - cur_offset) / PAGE_SIZE);
+                       return sg_page(sg) + (offset - cur_offset) / PAGE_SIZE;
                }
                cur_offset += sg->length;
        }
index ba92bb4e9af94e9e96d1574464809607fe193382..7dd0ac866461d21d4a3bda8bfe4a172f6405def8 100644 (file)
@@ -53,8 +53,7 @@ virtiovf_get_migration_page(struct virtiovf_data_buffer *buf,
                        buf->last_offset_sg = sg;
                        buf->sg_last_entry += i;
                        buf->last_offset = cur_offset;
-                       return nth_page(sg_page(sg),
-                                       (offset - cur_offset) / PAGE_SIZE);
+                       return sg_page(sg) + (offset - cur_offset) / PAGE_SIZE;
                }
                cur_offset += sg->length;
        }