Commit d1399f44 authored by wuzhouhui's avatar wuzhouhui Committed by Changpeng Liu
Browse files

bdev: remove unnecessary if when destroy shared_resource



When create channel, the fields that _spdk_bdev_channel_destroy_resource()
checked are always be set to non-null. Remove these unnecessary if
statements makes issue exposed more easily if something goes wrong.

Change-Id: I2d505c87176d4d49eb1528a258e4bea6477e0fe6
Signed-off-by: default avatarwuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/c/438799


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent f3109678
Loading
Loading
Loading
Loading
+9 −18
Original line number Diff line number Diff line
@@ -1734,18 +1734,10 @@ _spdk_bdev_channel_destroy_resource(struct spdk_bdev_channel *ch)
{
	struct spdk_bdev_shared_resource *shared_resource;

	if (!ch) {
		return;
	}

	if (ch->channel) {
	spdk_put_io_channel(ch->channel);
	}

	assert(ch->io_outstanding == 0);

	shared_resource = ch->shared_resource;
	if (shared_resource) {

	assert(ch->io_outstanding == 0);
	assert(shared_resource->ref > 0);
	shared_resource->ref--;
@@ -1756,7 +1748,6 @@ _spdk_bdev_channel_destroy_resource(struct spdk_bdev_channel *ch)
		free(shared_resource);
	}
}
}

/* Caller must hold bdev->internal.mutex. */
static void