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 <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/413028
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
GangCao 2018-05-30 16:15:32 -04:00 committed by Changpeng Liu
parent 85a822292d
commit c5f3ab7a73

View File

@ -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);
}