Skip to content

Commit 02bb047

Browse files
isilenceaxboe
authored andcommitted
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>
1 parent d7ae46b commit 02bb047

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

io_uring/zcrx.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -957,10 +957,14 @@ static bool io_zcrx_queue_cqe(struct io_kiocb *req, struct net_iov *niov,
957957
return true;
958958
}
959959

960-
static struct net_iov *io_zcrx_alloc_fallback(struct io_zcrx_area *area)
960+
static struct net_iov *io_alloc_fallback_niov(struct io_zcrx_ifq *ifq)
961961
{
962+
struct io_zcrx_area *area = ifq->area;
962963
struct net_iov *niov = NULL;
963964

965+
if (area->mem.is_dmabuf)
966+
return NULL;
967+
964968
spin_lock_bh(&area->freelist_lock);
965969
if (area->free_count)
966970
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,
10201024
struct page *src_page, unsigned int src_offset,
10211025
size_t len)
10221026
{
1023-
struct io_zcrx_area *area = ifq->area;
10241027
size_t copied = 0;
10251028
int ret = 0;
10261029

1027-
if (area->mem.is_dmabuf)
1028-
return -EFAULT;
1029-
10301030
while (len) {
10311031
struct io_copy_cache cc;
10321032
struct net_iov *niov;
10331033
size_t n;
10341034

1035-
niov = io_zcrx_alloc_fallback(area);
1035+
niov = io_alloc_fallback_niov(ifq);
10361036
if (!niov) {
10371037
ret = -ENOMEM;
10381038
break;

0 commit comments

Comments
 (0)