From d92e0a403ba1d5d66cb0a525cfc660767346c34d Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Mon, 4 Feb 2019 13:47:03 -0700 Subject: [PATCH] bdev/aio: Eliminate bdev_aio_initialize_channel Small static function only called from one place, so just inline it. Change-Id: Ibc54f790da55dd1635d81181208b1d506550ca9c Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/c/443307 Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Shuhei Matsumoto Reviewed-by: Paul Luse Reviewed-by: Jim Harris --- lib/bdev/aio/bdev_aio.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) 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; }