nvme: move ->retries setup to nvme_setup_cmd
authorChristoph Hellwig <hch@lst.de>
Wed, 5 Apr 2017 17:18:08 +0000 (19:18 +0200)
committerJens Axboe <axboe@fb.com>
Wed, 5 Apr 2017 18:05:08 +0000 (12:05 -0600)
->retries is counting the number of times a command is resubmitted, and
be cleared on the first time we see the command.  We currently don't do
that for non-PCIe command, which is easily fixed by moving the setup
to common code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/nvme/host/core.c
drivers/nvme/host/pci.c

index 3c908e1bc9039da89250f67a3613ff05a216ee5f..0437f44d00f9d922fee9a53964c7a1b5514e7b05 100644 (file)
@@ -350,6 +350,11 @@ int nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
 {
        int ret = BLK_MQ_RQ_QUEUE_OK;
 
+       if (!(req->rq_flags & RQF_DONTPREP)) {
+               req->retries = 0;
+               req->rq_flags |= RQF_DONTPREP;
+       }
+
        switch (req_op(req)) {
        case REQ_OP_DRV_IN:
        case REQ_OP_DRV_OUT:
index 9e686a67d93b730e9b245bc6a672c20c0478a21d..3818ab15a26e766cc8f05e581f41ca550798293a 100644 (file)
@@ -326,10 +326,6 @@ static int nvme_init_iod(struct request *rq, struct nvme_dev *dev)
        iod->nents = 0;
        iod->length = size;
 
-       if (!(rq->rq_flags & RQF_DONTPREP)) {
-               rq->retries = 0;
-               rq->rq_flags |= RQF_DONTPREP;
-       }
        return BLK_MQ_RQ_QUEUE_OK;
 }