From 7ffbf85daba0bd77b3c09c6548b40e3583321781 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Mon, 4 Feb 2019 14:07:58 -0700 Subject: [PATCH] bdev/aio: Store channels in a list in the group channel This isn't used just yet, but will be necessary temporarily during this patch series. Change-Id: I7f04426c27e3fe0417e2f60bac28217fa44c0cb2 Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/c/443310 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- lib/bdev/aio/bdev_aio.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/bdev/aio/bdev_aio.c b/lib/bdev/aio/bdev_aio.c index e982724f7..21edf8aab 100644 --- a/lib/bdev/aio/bdev_aio.c +++ b/lib/bdev/aio/bdev_aio.c @@ -66,8 +66,11 @@ struct bdev_aio_io_channel { }; struct bdev_aio_group_channel { - struct spdk_poller *poller; - int epfd; + struct spdk_poller *poller; + + TAILQ_HEAD(, bdev_aio_io_channel) channels; + + int epfd; }; struct file_disk { @@ -441,6 +444,9 @@ bdev_aio_create_cb(void *io_device, void *ctx_buf) SPDK_ERRLOG("epoll_ctl error\n"); return -1; } + + TAILQ_INSERT_TAIL(&group_ch_ctx->channels, ch, link); + return 0; } @@ -453,6 +459,7 @@ bdev_aio_destroy_cb(void *io_device, void *ctx_buf) group_ch_ctx = spdk_io_channel_get_ctx(io_channel->group_ch); epoll_ctl(group_ch_ctx->epfd, EPOLL_CTL_DEL, io_channel->efd, &event); + TAILQ_REMOVE(&group_ch_ctx->channels, io_channel, link); spdk_put_io_channel(io_channel->group_ch); close(io_channel->efd); io_destroy(io_channel->io_ctx); @@ -526,6 +533,8 @@ bdev_aio_group_create_cb(void *io_device, void *ctx_buf) { struct bdev_aio_group_channel *ch = ctx_buf; + TAILQ_INIT(&ch->channels); + ch->epfd = epoll_create1(0); if (ch->epfd == -1) { SPDK_ERRLOG("cannot create epoll fd\n");