]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
io_uring/zcrx: remove nth_page() usage within folio
authorDavid Hildenbrand <david@redhat.com>
Mon, 1 Sep 2025 15:03:41 +0000 (17:03 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:25:34 +0000 (17:25 -0700)
Within a folio/compound page, nth_page() is no longer required.  Given
that we call folio_test_partial_kmap()+kmap_local_page(), the code would
already be problematic if the pages would span multiple folios.

So let's just assume that all src pages belong to a single folio/compound
page and can be iterated ordinarily.  The dst page is currently always a
single page, so we're not actually iterating anything.

Link: https://lkml.kernel.org/r/20250901150359.867252-21-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
io_uring/zcrx.c

index e5ff49f3425e0752909deec2e87992b575848416..18c12f4b56b6ced46c436b3d769c8a9631479b6a 100644 (file)
@@ -975,9 +975,9 @@ static ssize_t io_copy_page(struct io_copy_cache *cc, struct page *src_page,
 
                if (folio_test_partial_kmap(page_folio(dst_page)) ||
                    folio_test_partial_kmap(page_folio(src_page))) {
-                       dst_page = nth_page(dst_page, dst_offset / PAGE_SIZE);
+                       dst_page += dst_offset / PAGE_SIZE;
                        dst_offset = offset_in_page(dst_offset);
-                       src_page = nth_page(src_page, src_offset / PAGE_SIZE);
+                       src_page += src_offset / PAGE_SIZE;
                        src_offset = offset_in_page(src_offset);
                        n = min(PAGE_SIZE - src_offset, PAGE_SIZE - dst_offset);
                        n = min(n, len);