]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
io_uring/zcrx: pass ifq to io_zcrx_alloc_fallback()
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 16 Sep 2025 14:27:51 +0000 (15:27 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 16 Sep 2025 18:37:20 +0000 (12:37 -0600)
io_zcrx_copy_chunk() doesn't and shouldn't care from which area the
buffer is allocated, don't try to resolve the area in it but pass the
ifq to io_zcrx_alloc_fallback() and let it handle it. Also rename it for
more clarity.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/zcrx.c

index 0f15e0fa5467e84178290679d3d3d6636daaa756..16bf036c7b24bb0716d60bc44e2beb29ebc6521e 100644 (file)
@@ -957,10 +957,14 @@ static bool io_zcrx_queue_cqe(struct io_kiocb *req, struct net_iov *niov,
        return true;
 }
 
-static struct net_iov *io_zcrx_alloc_fallback(struct io_zcrx_area *area)
+static struct net_iov *io_alloc_fallback_niov(struct io_zcrx_ifq *ifq)
 {
+       struct io_zcrx_area *area = ifq->area;
        struct net_iov *niov = NULL;
 
+       if (area->mem.is_dmabuf)
+               return NULL;
+
        spin_lock_bh(&area->freelist_lock);
        if (area->free_count)
                niov = __io_zcrx_get_free_niov(area);
@@ -1020,19 +1024,15 @@ static ssize_t io_zcrx_copy_chunk(struct io_kiocb *req, struct io_zcrx_ifq *ifq,
                                  struct page *src_page, unsigned int src_offset,
                                  size_t len)
 {
-       struct io_zcrx_area *area = ifq->area;
        size_t copied = 0;
        int ret = 0;
 
-       if (area->mem.is_dmabuf)
-               return -EFAULT;
-
        while (len) {
                struct io_copy_cache cc;
                struct net_iov *niov;
                size_t n;
 
-               niov = io_zcrx_alloc_fallback(area);
+               niov = io_alloc_fallback_niov(ifq);
                if (!niov) {
                        ret = -ENOMEM;
                        break;