From c5f3ab7a733f0973636141de7c74acca8547ba75 Mon Sep 17 00:00:00 2001 From: GangCao Date: Wed, 30 May 2018 16:15:32 -0400 Subject: [PATCH] bdev/qos: queue and submit directly on same thread There is some overhead notified for the message processing, instead to always send a message to the QoS thread, check whether the current thread is QoS thread or not. If yes, queue the IO immediately base on the QoS logic. Change-Id: I9c1f93aeaf68c9b1a0282c3b690614413949d901 Signed-off-by: GangCao Reviewed-on: https://review.gerrithub.io/413028 Tested-by: SPDK Automated Test System Reviewed-by: Daniel Verkamp Reviewed-by: Changpeng Liu --- lib/bdev/bdev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index 673c1bed9..ed14c0ea6 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -911,13 +911,18 @@ static void spdk_bdev_io_submit(struct spdk_bdev_io *bdev_io) { struct spdk_bdev *bdev = bdev_io->bdev; + struct spdk_thread *thread = spdk_io_channel_get_thread(bdev_io->ch->channel); assert(bdev_io->status == SPDK_BDEV_IO_STATUS_PENDING); if (bdev_io->ch->flags & BDEV_CH_QOS_ENABLED) { - bdev_io->io_submit_ch = bdev_io->ch; - bdev_io->ch = bdev->qos->ch; - spdk_thread_send_msg(bdev->qos->thread, _spdk_bdev_io_submit, bdev_io); + if (thread == bdev->qos->thread) { + _spdk_bdev_io_submit(bdev_io); + } else { + bdev_io->io_submit_ch = bdev_io->ch; + bdev_io->ch = bdev->qos->ch; + spdk_thread_send_msg(bdev->qos->thread, _spdk_bdev_io_submit, bdev_io); + } } else { _spdk_bdev_io_submit(bdev_io); }