summaryrefslogtreecommitdiffstats
path: root/drivers/nvme/target/loop.c
diff options
context:
space:
mode:
authorChristoph Hellwig2018-06-11 17:34:06 +0200
committerChristoph Hellwig2018-06-15 11:21:00 +0200
commit3bc32bb1186ccaf3177cbf29caa6cc14dc510b7b (patch)
tree72b01daec4fd9aad31e6768ba86789e79f420f48 /drivers/nvme/target/loop.c
parentblk-mq: remove blk_mq_tagset_iter (diff)
downloadkernel-qcow2-linux-3bc32bb1186ccaf3177cbf29caa6cc14dc510b7b.tar.gz
kernel-qcow2-linux-3bc32bb1186ccaf3177cbf29caa6cc14dc510b7b.tar.xz
kernel-qcow2-linux-3bc32bb1186ccaf3177cbf29caa6cc14dc510b7b.zip
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/target/loop.c')
-rw-r--r--drivers/nvme/target/loop.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
index 1304ec3a7ede..d8d91f04bd7e 100644
--- a/drivers/nvme/target/loop.c
+++ b/drivers/nvme/target/loop.c
@@ -158,12 +158,11 @@ static blk_status_t nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,
struct nvme_loop_queue *queue = hctx->driver_data;
struct request *req = bd->rq;
struct nvme_loop_iod *iod = blk_mq_rq_to_pdu(req);
+ bool queue_ready = test_bit(NVME_LOOP_Q_LIVE, &queue->flags);
blk_status_t ret;
- ret = nvmf_check_if_ready(&queue->ctrl->ctrl, req,
- test_bit(NVME_LOOP_Q_LIVE, &queue->flags), true);
- if (unlikely(ret))
- return ret;
+ if (!nvmf_check_ready(&queue->ctrl->ctrl, req, queue_ready))
+ return nvmf_fail_nonready_command(req);
ret = nvme_setup_cmd(ns, req, &iod->cmd);
if (ret)