From b9af5dd834f73d1ed8b8eb99d6426c0267e040d9 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Fri, 15 Nov 2019 09:18:03 -0700 Subject: [PATCH] lib/bdev: batch queued bdev reset completions. Previously, when additional resets were submitted while a reset was in progress, those resets were queued and then executed serially as part of executing the original reset. Doing multiple resets on a bdev in quick succession is not useful if the first reset succeeds and is very unlikely to be useful in the negative case. Instead, we should batch resets and complete them all at once when the current reset succeeds or fails. Change-Id: If10e0f37526860eaeeb41a8803d6298a3eff3212 Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474599 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris Community-CI: Broadcom SPDK FC-NVMe CI --- lib/bdev/bdev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index fc616aca0..4bdb57640 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -3851,12 +3851,16 @@ bdev_reset_complete(struct spdk_io_channel_iter *i, int status) static void bdev_unfreeze_channel(struct spdk_io_channel_iter *i) { + struct spdk_bdev_io *bdev_io = spdk_io_channel_iter_get_ctx(i); struct spdk_io_channel *_ch = spdk_io_channel_iter_get_channel(i); struct spdk_bdev_channel *ch = spdk_io_channel_get_ctx(_ch); + struct spdk_bdev_io *queued_reset; ch->flags &= ~BDEV_CH_RESET_IN_PROGRESS; - if (!TAILQ_EMPTY(&ch->queued_resets)) { - bdev_channel_start_reset(ch); + while (!TAILQ_EMPTY(&ch->queued_resets)) { + queued_reset = TAILQ_FIRST(&ch->queued_resets); + TAILQ_REMOVE(&ch->queued_resets, queued_reset, internal.link); + spdk_bdev_io_complete(queued_reset, bdev_io->internal.status); } spdk_for_each_channel_continue(i, 0);