]> www.infradead.org Git - users/hch/misc.git/commitdiff
scsi: scsi_lib: drop nth_page() usage within SG entry
authorDavid Hildenbrand <david@redhat.com>
Mon, 1 Sep 2025 15:03:51 +0000 (17:03 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 21 Sep 2025 21:22:08 +0000 (14:22 -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-31-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/scsi/scsi_lib.c

index 0c65ecfedfbd65c74819d660869994ce411a7bd0..d7e42293b864553d79a3cb9a55f2f433dbcb1fcc 100644 (file)
@@ -3148,8 +3148,7 @@ void *scsi_kmap_atomic_sg(struct scatterlist *sgl, int sg_count,
        /* Offset starting from the beginning of first page in this sg-entry */
        *offset = *offset - len_complete + sg->offset;
 
-       /* Assumption: contiguous pages can be accessed as "page + i" */
-       page = nth_page(sg_page(sg), (*offset >> PAGE_SHIFT));
+       page = sg_page(sg) + (*offset >> PAGE_SHIFT);
        *offset &= ~PAGE_MASK;
 
        /* Bytes in this sg-entry from *offset to the end of the page */