io_uring/zcrx: pass ifq to io_zcrx_alloc_fallback()

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>
pull/1354/merge
Pavel Begunkov 2025-09-16 15:27:51 +01:00 committed by Jens Axboe
parent d7ae46b454
commit 02bb047b5f
1 changed files with 6 additions and 6 deletions

View File

@ -957,10 +957,14 @@ static bool io_zcrx_queue_cqe(struct io_kiocb *req, struct net_iov *niov,
return true; 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; struct net_iov *niov = NULL;
if (area->mem.is_dmabuf)
return NULL;
spin_lock_bh(&area->freelist_lock); spin_lock_bh(&area->freelist_lock);
if (area->free_count) if (area->free_count)
niov = __io_zcrx_get_free_niov(area); 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, struct page *src_page, unsigned int src_offset,
size_t len) size_t len)
{ {
struct io_zcrx_area *area = ifq->area;
size_t copied = 0; size_t copied = 0;
int ret = 0; int ret = 0;
if (area->mem.is_dmabuf)
return -EFAULT;
while (len) { while (len) {
struct io_copy_cache cc; struct io_copy_cache cc;
struct net_iov *niov; struct net_iov *niov;
size_t n; size_t n;
niov = io_zcrx_alloc_fallback(area); niov = io_alloc_fallback_niov(ifq);
if (!niov) { if (!niov) {
ret = -ENOMEM; ret = -ENOMEM;
break; break;