nvme: split nvme status from block req->errors

We want our own clearly defined error field for NVMe passthrough commands,
and the request errors field is going away in its current form.

Just store the status and result field in the nvme_request field from
hardirq completion context (using a new helper) and then generate a
Linux errno for the block layer only when we actually need it.

Because we can't overload the status value with a negative error code
for cancelled command we now have a flags filed in struct nvme_request
that contains a bit for this condition.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
Christoph Hellwig
2017-04-20 16:02:57 +02:00
committed by Jens Axboe
parent d663b69ff3
commit 27fa9bc545
7 changed files with 65 additions and 60 deletions

View File

@@ -484,7 +484,7 @@ static void nvme_nvm_end_io(struct request *rq, int error)
struct nvm_rq *rqd = rq->end_io_data;
rqd->ppa_status = nvme_req(rq)->result.u64;
rqd->error = error;
rqd->error = nvme_req(rq)->status;
nvm_end_io(rqd);
kfree(nvme_req(rq)->cmd);
@@ -665,9 +665,12 @@ submit:
wait_for_completion_io(&wait);
ret = nvme_error_status(rq->errors);
if (nvme_req(rq)->flags & NVME_REQ_CANCELLED)
ret = -EINTR;
else
ret = nvme_error_status(rq);
if (result)
*result = rq->errors & 0x7ff;
*result = nvme_req(rq)->status & 0x7ff;
if (status)
*status = le64_to_cpu(nvme_req(rq)->result.u64);