Commit 5533c3d2 authored by Jim Harris's avatar Jim Harris
Browse files

util: defer put_io_channel



With vbdevs, there are many more cases where the last
(or only) channel for a given I/O device may be destroyed
in the context of the poller for that I/O device.  To
avoid returning to the poller and having it check
for data on a resource that was just released, instead
defer the actual put_io_channel work via
spdk_thread_send_msg().

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ic99776bddbe9a305f221f8c094ea97dce2d6df0b

Reviewed-on: https://review.gerrithub.io/368619


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent be2cb0c5
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -273,9 +273,11 @@ spdk_get_io_channel(void *io_device)
	return ch;
}

void
spdk_put_io_channel(struct spdk_io_channel *ch)
static void
_spdk_put_io_channel(void *arg)
{
	struct spdk_io_channel *ch = arg;

	if (ch->ref == 0) {
		SPDK_ERRLOG("ref already zero\n");
		return;
@@ -290,6 +292,12 @@ spdk_put_io_channel(struct spdk_io_channel *ch)
	}
}

void
spdk_put_io_channel(struct spdk_io_channel *ch)
{
	spdk_thread_send_msg(ch->thread, _spdk_put_io_channel, ch);
}

void *
spdk_io_channel_get_ctx(struct spdk_io_channel *ch)
{