Commit e45c36ff authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

bdev: simplify QoS poller registration



The helper functions were only needed when this was sent as a message,
but they are only called directly in the current code, so just move the
contents of the functions inline to their call sites.

The unregister path can also be simplified to pass the poller directly
to spdk_poller_unregister(); it already handles the case of a NULL
poller.

Change-Id: I509cf8922b53e1e616c9e976610b20061bb50066
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/403364


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 619a4f94
Loading
Loading
Loading
Loading
+6 −27
Original line number Diff line number Diff line
@@ -970,23 +970,6 @@ spdk_bdev_channel_poll_qos(void *arg)
	return -1;
}

static void
spdk_bdev_qos_register_poller(void *ctx)
{
	struct spdk_bdev_channel	*ch = ctx;

	ch->qos_poller = spdk_poller_register(spdk_bdev_channel_poll_qos, ch,
					      SPDK_BDEV_QOS_TIMESLICE_IN_USEC);
}

static void
spdk_bdev_qos_unregister_poller(void *ctx)
{
	struct spdk_poller	*poller = ctx;

	spdk_poller_unregister(&poller);
}

static int
_spdk_bdev_channel_create(struct spdk_bdev_channel *ch, void *io_device)
{
@@ -1088,7 +1071,10 @@ _spdk_bdev_qos_channel_create(struct spdk_bdev *bdev)

	bdev->qos_channel->flags |= BDEV_CH_QOS_ENABLED;
	spdk_bdev_qos_get_max_ios_per_timeslice(bdev);
	spdk_bdev_qos_register_poller(bdev->qos_channel);
	bdev->qos_channel->qos_poller = spdk_poller_register(
						spdk_bdev_channel_poll_qos,
						bdev->qos_channel,
						SPDK_BDEV_QOS_TIMESLICE_IN_USEC);

	return 0;
}
@@ -1098,28 +1084,21 @@ _spdk_bdev_qos_channel_destroy(void *ctx)
{
	struct spdk_bdev_channel	*qos_channel = ctx;
	struct spdk_bdev		*bdev = NULL;
	struct spdk_poller		*poller = NULL;

	if (!qos_channel) {
		SPDK_DEBUGLOG(SPDK_LOG_BDEV, "QoS channel already NULL\n");
		return;
	}

	bdev = qos_channel->bdev;
	poller = qos_channel->qos_poller;
	spdk_poller_unregister(&qos_channel->qos_poller);

	bdev = qos_channel->bdev;
	assert(bdev->qos_thread == spdk_get_thread());
	assert(bdev->qos_channel == qos_channel);

	free(bdev->qos_channel);
	bdev->qos_channel = NULL;
	bdev->qos_thread = NULL;

	if (!poller) {
		SPDK_DEBUGLOG(SPDK_LOG_BDEV, "QoS poller already NULL\n");
	} else {
		spdk_bdev_qos_unregister_poller(poller);
	}
}

static void