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:
parent
f31096782c
commit
d1399f4410
@ -1734,18 +1734,10 @@ _spdk_bdev_channel_destroy_resource(struct spdk_bdev_channel *ch)
|
|||||||
{
|
{
|
||||||
struct spdk_bdev_shared_resource *shared_resource;
|
struct spdk_bdev_shared_resource *shared_resource;
|
||||||
|
|
||||||
if (!ch) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ch->channel) {
|
|
||||||
spdk_put_io_channel(ch->channel);
|
spdk_put_io_channel(ch->channel);
|
||||||
}
|
|
||||||
|
|
||||||
assert(ch->io_outstanding == 0);
|
|
||||||
|
|
||||||
shared_resource = ch->shared_resource;
|
shared_resource = ch->shared_resource;
|
||||||
if (shared_resource) {
|
|
||||||
assert(ch->io_outstanding == 0);
|
assert(ch->io_outstanding == 0);
|
||||||
assert(shared_resource->ref > 0);
|
assert(shared_resource->ref > 0);
|
||||||
shared_resource->ref--;
|
shared_resource->ref--;
|
||||||
@ -1756,7 +1748,6 @@ _spdk_bdev_channel_destroy_resource(struct spdk_bdev_channel *ch)
|
|||||||
free(shared_resource);
|
free(shared_resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Caller must hold bdev->internal.mutex. */
|
/* Caller must hold bdev->internal.mutex. */
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user