diff options
-rw-r--r-- | drivers/block/nvme-core.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 37f22b6bb009..3153692da288 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -450,6 +450,18 @@ static void nvme_end_io_acct(struct bio *bio, unsigned long start_time) } } +static int nvme_error_status(u16 status) +{ + switch (status & 0x7ff) { + case NVME_SC_SUCCESS: + return 0; + case NVME_SC_CAP_EXCEEDED: + return -ENOSPC; + default: + return -EIO; + } +} + static void bio_completion(struct nvme_queue *nvmeq, void *ctx, struct nvme_completion *cqe) { @@ -469,7 +481,7 @@ static void bio_completion(struct nvme_queue *nvmeq, void *ctx, wake_up(&nvmeq->sq_full); return; } - error = -EIO; + error = nvme_error_status(status); } if (iod->nents) { dma_unmap_sg(nvmeq->q_dmadev, iod->sg, iod->nents, |