diff options
author | Christoph Hellwig <hch@lst.de> | 2018-06-11 17:34:06 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-06-15 11:21:00 +0200 |
commit | 3bc32bb1186ccaf3177cbf29caa6cc14dc510b7b (patch) | |
tree | 72b01daec4fd9aad31e6768ba86789e79f420f48 /drivers/nvme/host/fabrics.h | |
parent | e6c3456aa897c9799de5423b28550efad14a51b0 (diff) |
nvme-fabrics: refactor queue ready check
Move the is_connected check to the fibre channel transport, as it has no
meaning for other transports. To facilitate this split out a new
nvmf_fail_nonready_command helper that is called by the transport when
it is asked to handle a command on a queue that is not ready.
Also avoid a function call for the queue live fast path by inlining
the check.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: James Smart <james.smart@broadcom.com>
Diffstat (limited to 'drivers/nvme/host/fabrics.h')
-rw-r--r-- | drivers/nvme/host/fabrics.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h index 7491a0bbf711..2ea949a3868c 100644 --- a/drivers/nvme/host/fabrics.h +++ b/drivers/nvme/host/fabrics.h @@ -162,7 +162,16 @@ void nvmf_unregister_transport(struct nvmf_transport_ops *ops); void nvmf_free_options(struct nvmf_ctrl_options *opts); int nvmf_get_address(struct nvme_ctrl *ctrl, char *buf, int size); bool nvmf_should_reconnect(struct nvme_ctrl *ctrl); -blk_status_t nvmf_check_if_ready(struct nvme_ctrl *ctrl, - struct request *rq, bool queue_live, bool is_connected); +blk_status_t nvmf_fail_nonready_command(struct request *rq); +bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq, + bool queue_live); + +static inline bool nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq, + bool queue_live) +{ + if (likely(ctrl->state == NVME_CTRL_LIVE)) + return true; + return __nvmf_check_ready(ctrl, rq, queue_live); +} #endif /* _NVME_FABRICS_H */ |