From 2d36f6f11c8650d3bba054cd7fbb78319c5c2977 Mon Sep 17 00:00:00 2001 From: Liu Xiaodong Date: Sat, 2 Jan 2021 15:54:04 -0500 Subject: [PATCH] bdev_aio: add set interrupt mode to poller Change-Id: I089241bbb42c047e8ae4f206f2dad72c4a69f1d9 Signed-off-by: Liu Xiaodong Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5789 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker --- module/bdev/aio/bdev_aio.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/module/bdev/aio/bdev_aio.c b/module/bdev/aio/bdev_aio.c index 60801ac6e0..b9925ede6b 100644 --- a/module/bdev/aio/bdev_aio.c +++ b/module/bdev/aio/bdev_aio.c @@ -658,20 +658,31 @@ bdev_aio_unregister_interrupt(struct bdev_aio_group_channel *ch) ch->efd = -1; } +static void +bdev_aio_poller_set_interrupt_mode(struct spdk_poller *poller, void *cb_arg, bool interrupt_mode) +{ + return; +} + static int bdev_aio_group_create_cb(void *io_device, void *ctx_buf) { struct bdev_aio_group_channel *ch = ctx_buf; + int rc; TAILQ_INIT(&ch->io_ch_head); /* Initialize ch->efd to be invalid and unused. */ ch->efd = -1; - if (spdk_interrupt_mode_is_enabled()) { - return bdev_aio_register_interrupt(ch); + rc = bdev_aio_register_interrupt(ch); + if (rc < 0) { + SPDK_ERRLOG("Failed to prepare intr resource to bdev_aio\n"); + return rc; + } } ch->poller = SPDK_POLLER_REGISTER(bdev_aio_group_poll, ch, 0); + spdk_poller_register_interrupt(ch->poller, bdev_aio_poller_set_interrupt_mode, NULL); return 0; } @@ -685,12 +696,10 @@ bdev_aio_group_destroy_cb(void *io_device, void *ctx_buf) SPDK_ERRLOG("Group channel of bdev aio has uncleared io channel\n"); } - if (ch->intr) { - bdev_aio_unregister_interrupt(ch); - return; - } - spdk_poller_unregister(&ch->poller); + if (spdk_interrupt_mode_is_enabled()) { + bdev_aio_unregister_interrupt(ch); + } } int