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");