* [PATCH 1/2] nvme: untangle 0 and BLK_MQ_RQ_QUEUE_OK
@ 2016-11-15 19:11 ` Omar Sandoval
0 siblings, 0 replies; 8+ messages in thread
From: Omar Sandoval @ 2016-11-15 19:11 UTC (permalink / raw)
From: Omar Sandoval <osandov@fb.com>
Let's not depend on any of the BLK_MQ_RQ_QUEUE_* constants having
specific values. No functional change.
Signed-off-by: Omar Sandoval <osandov at fb.com>
---
drivers/nvme/host/core.c | 4 ++--
drivers/nvme/host/pci.c | 8 ++++----
drivers/nvme/host/rdma.c | 2 +-
drivers/nvme/target/loop.c | 6 +++---
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 53584d2..e54bb10 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -269,7 +269,7 @@ static inline int nvme_setup_discard(struct nvme_ns *ns, struct request *req,
*/
req->__data_len = nr_bytes;
- return 0;
+ return BLK_MQ_RQ_QUEUE_OK;
}
static inline void nvme_setup_rw(struct nvme_ns *ns, struct request *req,
@@ -317,7 +317,7 @@ static inline void nvme_setup_rw(struct nvme_ns *ns, struct request *req,
int nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
struct nvme_command *cmd)
{
- int ret = 0;
+ int ret = BLK_MQ_RQ_QUEUE_OK;
if (req->cmd_type == REQ_TYPE_DRV_PRIV)
memcpy(cmd, nvme_req(req)->cmd, sizeof(*cmd));
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 51d13d5..d58f8e4 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -328,7 +328,7 @@ static int nvme_init_iod(struct request *rq, unsigned size,
rq->retries = 0;
rq->rq_flags |= RQF_DONTPREP;
}
- return 0;
+ return BLK_MQ_RQ_QUEUE_OK;
}
static void nvme_free_iod(struct nvme_dev *dev, struct request *req)
@@ -598,17 +598,17 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
map_len = nvme_map_len(req);
ret = nvme_init_iod(req, map_len, dev);
- if (ret)
+ if (ret != BLK_MQ_RQ_QUEUE_OK)
return ret;
ret = nvme_setup_cmd(ns, req, &cmnd);
- if (ret)
+ if (ret != BLK_MQ_RQ_QUEUE_OK)
goto out;
if (req->nr_phys_segments)
ret = nvme_map_data(dev, req, map_len, &cmnd);
- if (ret)
+ if (ret != BLK_MQ_RQ_QUEUE_OK)
goto out;
cmnd.common.command_id = req->tag;
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index c4700ef..ff1b34060 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1395,7 +1395,7 @@ static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx,
sizeof(struct nvme_command), DMA_TO_DEVICE);
ret = nvme_setup_cmd(ns, rq, c);
- if (ret)
+ if (ret != BLK_MQ_RQ_QUEUE_OK)
return ret;
c->common.command_id = rq->tag;
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
index 26aa3a5..be56d05 100644
--- a/drivers/nvme/target/loop.c
+++ b/drivers/nvme/target/loop.c
@@ -169,7 +169,7 @@ static int nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,
int ret;
ret = nvme_setup_cmd(ns, req, &iod->cmd);
- if (ret)
+ if (ret != BLK_MQ_RQ_QUEUE_OK)
return ret;
iod->cmd.common.flags |= NVME_CMD_SGL_METABUF;
@@ -179,7 +179,7 @@ static int nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,
nvme_cleanup_cmd(req);
blk_mq_start_request(req);
nvme_loop_queue_response(&iod->req);
- return 0;
+ return BLK_MQ_RQ_QUEUE_OK;
}
if (blk_rq_bytes(req)) {
@@ -198,7 +198,7 @@ static int nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,
blk_mq_start_request(req);
schedule_work(&iod->work);
- return 0;
+ return BLK_MQ_RQ_QUEUE_OK;
}
static void nvme_loop_submit_async_event(struct nvme_ctrl *arg, int aer_idx)
--
2.10.2
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/2] scsi_lib: untangle 0 and BLK_MQ_RQ_QUEUE_OK
2016-11-15 19:11 ` Omar Sandoval
@ 2016-11-15 19:11 ` Omar Sandoval
-1 siblings, 0 replies; 8+ messages in thread
From: Omar Sandoval @ 2016-11-15 19:11 UTC (permalink / raw)
To: linux-block; +Cc: linux-nvme, linux-scsi, kernel-team
From: Omar Sandoval <osandov@fb.com>
Let's not depend on any of the BLK_MQ_RQ_QUEUE_* constants having
specific values. No functional change.
Signed-off-by: Omar Sandoval <osandov@fb.com>
---
drivers/scsi/scsi_lib.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 2e35132..47a5c87 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1810,7 +1810,7 @@ static inline int prep_to_mq(int ret)
{
switch (ret) {
case BLKPREP_OK:
- return 0;
+ return BLK_MQ_RQ_QUEUE_OK;
case BLKPREP_DEFER:
return BLK_MQ_RQ_QUEUE_BUSY;
default:
@@ -1897,7 +1897,7 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
int reason;
ret = prep_to_mq(scsi_prep_state_check(sdev, req));
- if (ret)
+ if (ret != BLK_MQ_RQ_QUEUE_OK)
goto out;
ret = BLK_MQ_RQ_QUEUE_BUSY;
@@ -1914,7 +1914,7 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
if (!(req->rq_flags & RQF_DONTPREP)) {
ret = prep_to_mq(scsi_mq_prep_fn(req));
- if (ret)
+ if (ret != BLK_MQ_RQ_QUEUE_OK)
goto out_dec_host_busy;
req->rq_flags |= RQF_DONTPREP;
} else {
--
2.10.2
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/2] scsi_lib: untangle 0 and BLK_MQ_RQ_QUEUE_OK
@ 2016-11-15 19:11 ` Omar Sandoval
0 siblings, 0 replies; 8+ messages in thread
From: Omar Sandoval @ 2016-11-15 19:11 UTC (permalink / raw)
From: Omar Sandoval <osandov@fb.com>
Let's not depend on any of the BLK_MQ_RQ_QUEUE_* constants having
specific values. No functional change.
Signed-off-by: Omar Sandoval <osandov at fb.com>
---
drivers/scsi/scsi_lib.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 2e35132..47a5c87 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1810,7 +1810,7 @@ static inline int prep_to_mq(int ret)
{
switch (ret) {
case BLKPREP_OK:
- return 0;
+ return BLK_MQ_RQ_QUEUE_OK;
case BLKPREP_DEFER:
return BLK_MQ_RQ_QUEUE_BUSY;
default:
@@ -1897,7 +1897,7 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
int reason;
ret = prep_to_mq(scsi_prep_state_check(sdev, req));
- if (ret)
+ if (ret != BLK_MQ_RQ_QUEUE_OK)
goto out;
ret = BLK_MQ_RQ_QUEUE_BUSY;
@@ -1914,7 +1914,7 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
if (!(req->rq_flags & RQF_DONTPREP)) {
ret = prep_to_mq(scsi_mq_prep_fn(req));
- if (ret)
+ if (ret != BLK_MQ_RQ_QUEUE_OK)
goto out_dec_host_busy;
req->rq_flags |= RQF_DONTPREP;
} else {
--
2.10.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] nvme: untangle 0 and BLK_MQ_RQ_QUEUE_OK
2016-11-15 19:11 ` Omar Sandoval
@ 2016-11-15 19:44 ` Keith Busch
-1 siblings, 0 replies; 8+ messages in thread
From: Keith Busch @ 2016-11-15 19:44 UTC (permalink / raw)
To: Omar Sandoval; +Cc: linux-block, kernel-team, linux-scsi, linux-nvme
On Tue, Nov 15, 2016 at 11:11:58AM -0800, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
>
> Let's not depend on any of the BLK_MQ_RQ_QUEUE_* constants having
> specific values. No functional change.
>
> Signed-off-by: Omar Sandoval <osandov@fb.com>
Yeah, we've been depending on the values of BLK_MQ_RQ_QUEUE_[ERROR|BUSY]
not being zero without this. Looks good.
Reviewed-by: Keith Busch <keith.busch@intel.com>
> ---
> drivers/nvme/host/core.c | 4 ++--
> drivers/nvme/host/pci.c | 8 ++++----
> drivers/nvme/host/rdma.c | 2 +-
> drivers/nvme/target/loop.c | 6 +++---
> 4 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 53584d2..e54bb10 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -269,7 +269,7 @@ static inline int nvme_setup_discard(struct nvme_ns *ns, struct request *req,
> */
> req->__data_len = nr_bytes;
>
> - return 0;
> + return BLK_MQ_RQ_QUEUE_OK;
> }
>
> static inline void nvme_setup_rw(struct nvme_ns *ns, struct request *req,
> @@ -317,7 +317,7 @@ static inline void nvme_setup_rw(struct nvme_ns *ns, struct request *req,
> int nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
> struct nvme_command *cmd)
> {
> - int ret = 0;
> + int ret = BLK_MQ_RQ_QUEUE_OK;
>
> if (req->cmd_type == REQ_TYPE_DRV_PRIV)
> memcpy(cmd, nvme_req(req)->cmd, sizeof(*cmd));
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 51d13d5..d58f8e4 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -328,7 +328,7 @@ static int nvme_init_iod(struct request *rq, unsigned size,
> rq->retries = 0;
> rq->rq_flags |= RQF_DONTPREP;
> }
> - return 0;
> + return BLK_MQ_RQ_QUEUE_OK;
> }
>
> static void nvme_free_iod(struct nvme_dev *dev, struct request *req)
> @@ -598,17 +598,17 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
>
> map_len = nvme_map_len(req);
> ret = nvme_init_iod(req, map_len, dev);
> - if (ret)
> + if (ret != BLK_MQ_RQ_QUEUE_OK)
> return ret;
>
> ret = nvme_setup_cmd(ns, req, &cmnd);
> - if (ret)
> + if (ret != BLK_MQ_RQ_QUEUE_OK)
> goto out;
>
> if (req->nr_phys_segments)
> ret = nvme_map_data(dev, req, map_len, &cmnd);
>
> - if (ret)
> + if (ret != BLK_MQ_RQ_QUEUE_OK)
> goto out;
>
> cmnd.common.command_id = req->tag;
> diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
> index c4700ef..ff1b34060 100644
> --- a/drivers/nvme/host/rdma.c
> +++ b/drivers/nvme/host/rdma.c
> @@ -1395,7 +1395,7 @@ static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx,
> sizeof(struct nvme_command), DMA_TO_DEVICE);
>
> ret = nvme_setup_cmd(ns, rq, c);
> - if (ret)
> + if (ret != BLK_MQ_RQ_QUEUE_OK)
> return ret;
>
> c->common.command_id = rq->tag;
> diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
> index 26aa3a5..be56d05 100644
> --- a/drivers/nvme/target/loop.c
> +++ b/drivers/nvme/target/loop.c
> @@ -169,7 +169,7 @@ static int nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,
> int ret;
>
> ret = nvme_setup_cmd(ns, req, &iod->cmd);
> - if (ret)
> + if (ret != BLK_MQ_RQ_QUEUE_OK)
> return ret;
>
> iod->cmd.common.flags |= NVME_CMD_SGL_METABUF;
> @@ -179,7 +179,7 @@ static int nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,
> nvme_cleanup_cmd(req);
> blk_mq_start_request(req);
> nvme_loop_queue_response(&iod->req);
> - return 0;
> + return BLK_MQ_RQ_QUEUE_OK;
> }
>
> if (blk_rq_bytes(req)) {
> @@ -198,7 +198,7 @@ static int nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,
> blk_mq_start_request(req);
>
> schedule_work(&iod->work);
> - return 0;
> + return BLK_MQ_RQ_QUEUE_OK;
> }
>
> static void nvme_loop_submit_async_event(struct nvme_ctrl *arg, int aer_idx)
> --
> 2.10.2
>
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/2] nvme: untangle 0 and BLK_MQ_RQ_QUEUE_OK
@ 2016-11-15 19:44 ` Keith Busch
0 siblings, 0 replies; 8+ messages in thread
From: Keith Busch @ 2016-11-15 19:44 UTC (permalink / raw)
On Tue, Nov 15, 2016@11:11:58AM -0800, Omar Sandoval wrote:
> From: Omar Sandoval <osandov at fb.com>
>
> Let's not depend on any of the BLK_MQ_RQ_QUEUE_* constants having
> specific values. No functional change.
>
> Signed-off-by: Omar Sandoval <osandov at fb.com>
Yeah, we've been depending on the values of BLK_MQ_RQ_QUEUE_[ERROR|BUSY]
not being zero without this. Looks good.
Reviewed-by: Keith Busch <keith.busch at intel.com>
> ---
> drivers/nvme/host/core.c | 4 ++--
> drivers/nvme/host/pci.c | 8 ++++----
> drivers/nvme/host/rdma.c | 2 +-
> drivers/nvme/target/loop.c | 6 +++---
> 4 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 53584d2..e54bb10 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -269,7 +269,7 @@ static inline int nvme_setup_discard(struct nvme_ns *ns, struct request *req,
> */
> req->__data_len = nr_bytes;
>
> - return 0;
> + return BLK_MQ_RQ_QUEUE_OK;
> }
>
> static inline void nvme_setup_rw(struct nvme_ns *ns, struct request *req,
> @@ -317,7 +317,7 @@ static inline void nvme_setup_rw(struct nvme_ns *ns, struct request *req,
> int nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
> struct nvme_command *cmd)
> {
> - int ret = 0;
> + int ret = BLK_MQ_RQ_QUEUE_OK;
>
> if (req->cmd_type == REQ_TYPE_DRV_PRIV)
> memcpy(cmd, nvme_req(req)->cmd, sizeof(*cmd));
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 51d13d5..d58f8e4 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -328,7 +328,7 @@ static int nvme_init_iod(struct request *rq, unsigned size,
> rq->retries = 0;
> rq->rq_flags |= RQF_DONTPREP;
> }
> - return 0;
> + return BLK_MQ_RQ_QUEUE_OK;
> }
>
> static void nvme_free_iod(struct nvme_dev *dev, struct request *req)
> @@ -598,17 +598,17 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
>
> map_len = nvme_map_len(req);
> ret = nvme_init_iod(req, map_len, dev);
> - if (ret)
> + if (ret != BLK_MQ_RQ_QUEUE_OK)
> return ret;
>
> ret = nvme_setup_cmd(ns, req, &cmnd);
> - if (ret)
> + if (ret != BLK_MQ_RQ_QUEUE_OK)
> goto out;
>
> if (req->nr_phys_segments)
> ret = nvme_map_data(dev, req, map_len, &cmnd);
>
> - if (ret)
> + if (ret != BLK_MQ_RQ_QUEUE_OK)
> goto out;
>
> cmnd.common.command_id = req->tag;
> diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
> index c4700ef..ff1b34060 100644
> --- a/drivers/nvme/host/rdma.c
> +++ b/drivers/nvme/host/rdma.c
> @@ -1395,7 +1395,7 @@ static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx,
> sizeof(struct nvme_command), DMA_TO_DEVICE);
>
> ret = nvme_setup_cmd(ns, rq, c);
> - if (ret)
> + if (ret != BLK_MQ_RQ_QUEUE_OK)
> return ret;
>
> c->common.command_id = rq->tag;
> diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
> index 26aa3a5..be56d05 100644
> --- a/drivers/nvme/target/loop.c
> +++ b/drivers/nvme/target/loop.c
> @@ -169,7 +169,7 @@ static int nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,
> int ret;
>
> ret = nvme_setup_cmd(ns, req, &iod->cmd);
> - if (ret)
> + if (ret != BLK_MQ_RQ_QUEUE_OK)
> return ret;
>
> iod->cmd.common.flags |= NVME_CMD_SGL_METABUF;
> @@ -179,7 +179,7 @@ static int nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,
> nvme_cleanup_cmd(req);
> blk_mq_start_request(req);
> nvme_loop_queue_response(&iod->req);
> - return 0;
> + return BLK_MQ_RQ_QUEUE_OK;
> }
>
> if (blk_rq_bytes(req)) {
> @@ -198,7 +198,7 @@ static int nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,
> blk_mq_start_request(req);
>
> schedule_work(&iod->work);
> - return 0;
> + return BLK_MQ_RQ_QUEUE_OK;
> }
>
> static void nvme_loop_submit_async_event(struct nvme_ctrl *arg, int aer_idx)
> --
> 2.10.2
>
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] nvme: untangle 0 and BLK_MQ_RQ_QUEUE_OK
2016-11-15 19:11 ` Omar Sandoval
@ 2016-11-15 19:51 ` Jens Axboe
-1 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2016-11-15 19:51 UTC (permalink / raw)
To: Omar Sandoval, linux-block; +Cc: linux-nvme, linux-scsi, kernel-team
On 11/15/2016 12:11 PM, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
>
> Let's not depend on any of the BLK_MQ_RQ_QUEUE_* constants having
> specific values. No functional change.
Thanks Omar, applied both for 4.10.
--
Jens Axboe
^ permalink raw reply [flat|nested] 8+ messages in thread