bdev/nvme: Factor out searching io_path operation from find_io_path()
Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Change-Id: I26939b39cfd4b92bdbc1d4ef10961ba35145043c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12000 Community-CI: Mellanox Build Bot Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Dong Yi <dongx.yi@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
parent
22b77a3c80
commit
0869265d66
@ -825,15 +825,11 @@ nvme_ctrlr_is_available(struct nvme_ctrlr *nvme_ctrlr)
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline struct nvme_io_path *
|
||||
bdev_nvme_find_io_path(struct nvme_bdev_channel *nbdev_ch)
|
||||
static struct nvme_io_path *
|
||||
_bdev_nvme_find_io_path(struct nvme_bdev_channel *nbdev_ch)
|
||||
{
|
||||
struct nvme_io_path *io_path, *non_optimized = NULL;
|
||||
|
||||
if (spdk_likely(nbdev_ch->current_io_path != NULL)) {
|
||||
return nbdev_ch->current_io_path;
|
||||
}
|
||||
|
||||
STAILQ_FOREACH(io_path, &nbdev_ch->io_path_list, stailq) {
|
||||
if (spdk_unlikely(!nvme_io_path_is_connected(io_path))) {
|
||||
/* The device is currently resetting. */
|
||||
@ -861,6 +857,16 @@ bdev_nvme_find_io_path(struct nvme_bdev_channel *nbdev_ch)
|
||||
return non_optimized;
|
||||
}
|
||||
|
||||
static inline struct nvme_io_path *
|
||||
bdev_nvme_find_io_path(struct nvme_bdev_channel *nbdev_ch)
|
||||
{
|
||||
if (spdk_unlikely(nbdev_ch->current_io_path == NULL)) {
|
||||
return _bdev_nvme_find_io_path(nbdev_ch);
|
||||
}
|
||||
|
||||
return nbdev_ch->current_io_path;
|
||||
}
|
||||
|
||||
/* Return true if there is any io_path whose qpair is active or ctrlr is not failed,
|
||||
* or false otherwise.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user