nvmf: refactor nvmf_tgt_destroy_cb
This preps for some upcoming patches as well as removing two levels of indentation. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I4f685c1e44ec4aa261e68af1786cfc110f451ed5 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17960 Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
parent
c387766501
commit
c4ce596187
@ -360,29 +360,34 @@ static void
|
|||||||
nvmf_tgt_destroy_cb(void *io_device)
|
nvmf_tgt_destroy_cb(void *io_device)
|
||||||
{
|
{
|
||||||
struct spdk_nvmf_tgt *tgt = io_device;
|
struct spdk_nvmf_tgt *tgt = io_device;
|
||||||
|
struct spdk_nvmf_subsystem *subsystem;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (tgt->subsystems) {
|
if (tgt->subsystems == NULL) {
|
||||||
for (i = 0; i < tgt->max_subsystems; i++) {
|
_nvmf_tgt_destroy_next_transport(tgt);
|
||||||
if (tgt->subsystems[i]) {
|
return;
|
||||||
nvmf_subsystem_remove_all_listeners(tgt->subsystems[i], true);
|
|
||||||
|
|
||||||
rc = spdk_nvmf_subsystem_destroy(tgt->subsystems[i], nvmf_tgt_destroy_cb, tgt);
|
|
||||||
if (rc) {
|
|
||||||
if (rc == -EINPROGRESS) {
|
|
||||||
/* If rc is -EINPROGRESS, nvmf_tgt_destroy_cb will be called again when subsystem #i
|
|
||||||
* is destroyed, nvmf_tgt_destroy_cb will continue to destroy other subsystems if any */
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
SPDK_ERRLOG("Failed to destroy subsystem %s, rc %d\n", tgt->subsystems[i]->subnqn, rc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(tgt->subsystems);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < tgt->max_subsystems; i++) {
|
||||||
|
subsystem = tgt->subsystems[i];
|
||||||
|
if (subsystem == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
nvmf_subsystem_remove_all_listeners(subsystem, true);
|
||||||
|
|
||||||
|
rc = spdk_nvmf_subsystem_destroy(subsystem, nvmf_tgt_destroy_cb, tgt);
|
||||||
|
if (rc) {
|
||||||
|
if (rc == -EINPROGRESS) {
|
||||||
|
/* If rc is -EINPROGRESS, nvmf_tgt_destroy_cb will be called again when subsystem #i
|
||||||
|
* is destroyed, nvmf_tgt_destroy_cb will continue to destroy other subsystems if any */
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
SPDK_ERRLOG("Failed to destroy subsystem %s, rc %d\n", subsystem->subnqn, rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(tgt->subsystems);
|
||||||
_nvmf_tgt_destroy_next_transport(tgt);
|
_nvmf_tgt_destroy_next_transport(tgt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user