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: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/c/438799
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
wuzhouhui 2019-01-02 20:16:12 +08:00 committed by Changpeng Liu
parent f31096782c
commit d1399f4410

View File

@ -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--;
@ -1755,7 +1747,6 @@ _spdk_bdev_channel_destroy_resource(struct spdk_bdev_channel *ch)
spdk_put_io_channel(spdk_io_channel_from_ctx(shared_resource->mgmt_ch));
free(shared_resource);
}
}
}
/* Caller must hold bdev->internal.mutex. */