diff --git a/lib/bdev/aio/bdev_aio.c b/lib/bdev/aio/bdev_aio.c index 3c5eff7ad..d281944b1 100644 --- a/lib/bdev/aio/bdev_aio.c +++ b/lib/bdev/aio/bdev_aio.c @@ -209,24 +209,6 @@ bdev_aio_destruct(void *ctx) return rc; } -static int -bdev_aio_initialize_io_channel(struct bdev_aio_io_channel *ch) -{ - ch->efd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); - if (ch->efd == -1) { - SPDK_ERRLOG("Cannot create efd\n"); - return -1; - } - - if (io_setup(SPDK_AIO_QUEUE_DEPTH, &ch->io_ctx) < 0) { - close(ch->efd); - SPDK_ERRLOG("async I/O context setup failure\n"); - return -1; - } - - return 0; -} - static int bdev_aio_group_poll(void *arg) { @@ -409,7 +391,15 @@ bdev_aio_create_cb(void *io_device, void *ctx_buf) struct bdev_aio_group_channel *group_ch_ctx; struct epoll_event epevent; - if (bdev_aio_initialize_io_channel(ch) != 0) { + ch->efd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); + if (ch->efd == -1) { + SPDK_ERRLOG("Cannot create efd\n"); + return -1; + } + + if (io_setup(SPDK_AIO_QUEUE_DEPTH, &ch->io_ctx) < 0) { + close(ch->efd); + SPDK_ERRLOG("async I/O context setup failure\n"); return -1; }