nvmf: Capture channel variable to stack when updating poll groups
This signals to the compiler and analysis programs that this won't change during iteration, so it may produce better code. Change-Id: I478c0c9445d4ddf8a69ab1b3deaf628b82a0eaea Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459753 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
This commit is contained in:
parent
75b4f332f4
commit
ab3abc15aa
@ -869,6 +869,7 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
|
||||
uint32_t i, j;
|
||||
struct spdk_nvmf_ns *ns;
|
||||
struct spdk_nvmf_registrant *reg, *tmp;
|
||||
struct spdk_io_channel *ch;
|
||||
|
||||
/* Make sure our poll group has memory for this subsystem allocated */
|
||||
if (subsystem->id >= group->num_sgroups) {
|
||||
@ -933,13 +934,15 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
|
||||
/* Detect bdevs that were added or removed */
|
||||
for (i = 0; i < sgroup->num_ns; i++) {
|
||||
ns = subsystem->ns[i];
|
||||
if (ns == NULL && sgroup->ns_info[i].channel == NULL) {
|
||||
ch = sgroup->ns_info[i].channel;
|
||||
|
||||
if (ns == NULL && ch == NULL) {
|
||||
/* Both NULL. Leave empty */
|
||||
} else if (ns == NULL && sgroup->ns_info[i].channel != NULL) {
|
||||
} else if (ns == NULL && ch != NULL) {
|
||||
/* There was a channel here, but the namespace is gone. */
|
||||
spdk_put_io_channel(sgroup->ns_info[i].channel);
|
||||
spdk_put_io_channel(ch);
|
||||
sgroup->ns_info[i].channel = NULL;
|
||||
} else if (ns != NULL && sgroup->ns_info[i].channel == NULL) {
|
||||
} else if (ns != NULL && ch == NULL) {
|
||||
/* A namespace appeared but there is no channel yet */
|
||||
sgroup->ns_info[i].channel = spdk_bdev_get_io_channel(ns->desc);
|
||||
if (sgroup->ns_info[i].channel == NULL) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user