bdev/nvme: Inline bdev_nvme_delete_secondary_trid
It can be much simpler when inlined. Signed-off-by: Ben Walker <benjamin.walker@intel.com> Change-Id: Ifad89d7b9557a45eee601fc2004066a0fd9289c0 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9826 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
be6a2feff2
commit
fa36884a78
@ -3107,27 +3107,6 @@ bdev_nvme_create(struct spdk_nvme_transport_id *trid,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
bdev_nvme_delete_secondary_trid(struct nvme_ctrlr *nvme_ctrlr,
|
||||
const struct spdk_nvme_transport_id *trid)
|
||||
{
|
||||
struct nvme_path_id *path_id, *tmp_path;
|
||||
|
||||
if (!spdk_nvme_transport_id_compare(trid, &nvme_ctrlr->active_path_id->trid)) {
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
TAILQ_FOREACH_SAFE(path_id, &nvme_ctrlr->trids, link, tmp_path) {
|
||||
if (!spdk_nvme_transport_id_compare(&path_id->trid, trid)) {
|
||||
TAILQ_REMOVE(&nvme_ctrlr->trids, path_id, link);
|
||||
free(path_id);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
int
|
||||
bdev_nvme_delete(const char *name, const struct nvme_path_id *path_id)
|
||||
{
|
||||
@ -3146,10 +3125,6 @@ bdev_nvme_delete(const char *name, const struct nvme_path_id *path_id)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* The following is based on an assumption that one trid can be registered
|
||||
* to only one nvme_ctrlr.
|
||||
*/
|
||||
|
||||
TAILQ_FOREACH_SAFE(nvme_ctrlr, &nbdev_ctrlr->ctrlrs, tailq, tmp_nvme_ctrlr) {
|
||||
TAILQ_FOREACH_REVERSE_SAFE(p, &nvme_ctrlr->trids, nvme_paths, link, t) {
|
||||
if (path_id->trid.trtype != 0) {
|
||||
@ -3201,7 +3176,9 @@ bdev_nvme_delete(const char *name, const struct nvme_path_id *path_id)
|
||||
}
|
||||
} else {
|
||||
/* We are not using the specified path. */
|
||||
rc = bdev_nvme_delete_secondary_trid(nvme_ctrlr, &p->trid);
|
||||
TAILQ_REMOVE(&nvme_ctrlr->trids, p, link);
|
||||
free(p);
|
||||
rc = 0;
|
||||
}
|
||||
|
||||
if (rc < 0 && rc != -ENXIO) {
|
||||
|
Loading…
Reference in New Issue
Block a user