mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
io_uring/zcrx: move io_unregister_zcrx_ifqs() down
In preparation for removing the ref on ctx->refs held by an ifq and removing io_shutdown_zcrx_ifqs(), move io_unregister_zcrx_ifqs() down such that it can call io_zcrx_scrub(). Signed-off-by: David Wei <dw@davidwei.uk> Reviewed-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -662,28 +662,6 @@ ifq_free:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void io_unregister_zcrx_ifqs(struct io_ring_ctx *ctx)
|
|
||||||
{
|
|
||||||
struct io_zcrx_ifq *ifq;
|
|
||||||
|
|
||||||
lockdep_assert_held(&ctx->uring_lock);
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
scoped_guard(mutex, &ctx->mmap_lock) {
|
|
||||||
unsigned long id = 0;
|
|
||||||
|
|
||||||
ifq = xa_find(&ctx->zcrx_ctxs, &id, ULONG_MAX, XA_PRESENT);
|
|
||||||
if (ifq)
|
|
||||||
xa_erase(&ctx->zcrx_ctxs, id);
|
|
||||||
}
|
|
||||||
if (!ifq)
|
|
||||||
break;
|
|
||||||
io_zcrx_ifq_free(ifq);
|
|
||||||
}
|
|
||||||
|
|
||||||
xa_destroy(&ctx->zcrx_ctxs);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct net_iov *__io_zcrx_get_free_niov(struct io_zcrx_area *area)
|
static struct net_iov *__io_zcrx_get_free_niov(struct io_zcrx_area *area)
|
||||||
{
|
{
|
||||||
unsigned niov_idx;
|
unsigned niov_idx;
|
||||||
@@ -749,6 +727,28 @@ void io_shutdown_zcrx_ifqs(struct io_ring_ctx *ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void io_unregister_zcrx_ifqs(struct io_ring_ctx *ctx)
|
||||||
|
{
|
||||||
|
struct io_zcrx_ifq *ifq;
|
||||||
|
|
||||||
|
lockdep_assert_held(&ctx->uring_lock);
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
scoped_guard(mutex, &ctx->mmap_lock) {
|
||||||
|
unsigned long id = 0;
|
||||||
|
|
||||||
|
ifq = xa_find(&ctx->zcrx_ctxs, &id, ULONG_MAX, XA_PRESENT);
|
||||||
|
if (ifq)
|
||||||
|
xa_erase(&ctx->zcrx_ctxs, id);
|
||||||
|
}
|
||||||
|
if (!ifq)
|
||||||
|
break;
|
||||||
|
io_zcrx_ifq_free(ifq);
|
||||||
|
}
|
||||||
|
|
||||||
|
xa_destroy(&ctx->zcrx_ctxs);
|
||||||
|
}
|
||||||
|
|
||||||
static inline u32 io_zcrx_rqring_entries(struct io_zcrx_ifq *ifq)
|
static inline u32 io_zcrx_rqring_entries(struct io_zcrx_ifq *ifq)
|
||||||
{
|
{
|
||||||
u32 entries;
|
u32 entries;
|
||||||
|
|||||||
Reference in New Issue
Block a user