From: Halil Pasic <pasic@linux.ibm.com>
To: "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Jens Axboe <axboe@kernel.dk>,
virtualization@lists.linux-foundation.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-s390@vger.kernel.org,
Christian Borntraeger <borntraeger@de.ibm.com>,
Viktor Mihajlovski <mihajlov@linux.ibm.com>,
Cornelia Huck <cohuck@redhat.com>, Ram Pai <linuxram@us.ibm.com>,
Thiago Jung Bauermann <bauerman@linux.ibm.com>,
"Lendacky, Thomas" <Thomas.Lendacky@amd.com>
Subject: [PATCH 2/2] virtio-blk: improve virtqueue error to BLK_STS
Date: Thu, 13 Feb 2020 13:37:28 +0100 [thread overview]
Message-ID: <20200213123728.61216-3-pasic@linux.ibm.com> (raw)
In-Reply-To: <20200213123728.61216-1-pasic@linux.ibm.com>
Let's change the mapping between virtqueue_add errors to BLK_STS
statuses, so that -ENOSPC, which indicates virtqueue full is still
mapped to BLK_STS_DEV_RESOURCE, but -ENOMEM which indicates non-device
specific resource outage is mapped to BLK_STS_RESOURCE.
Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
---
See comment about BLK_STS_DEV_RESOURCE in include/linux/blk_types.h
---
drivers/block/virtio_blk.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index adfe43f5ffe4..0736248999b0 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -251,9 +251,14 @@ static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx,
if (err == -ENOSPC)
blk_mq_stop_hw_queue(hctx);
spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags);
- if (err == -ENOMEM || err == -ENOSPC)
+ switch (err) {
+ case -ENOSPC:
return BLK_STS_DEV_RESOURCE;
- return BLK_STS_IOERR;
+ case -ENOMEM:
+ return BLK_STS_RESOURCE;
+ default:
+ return BLK_STS_IOERR;
+ }
}
if (bd->last && virtqueue_kick_prepare(vblk->vqs[qid].vq))
--
2.17.1
next prev parent reply other threads:[~2020-02-13 12:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-13 12:37 [PATCH 0/2] virtio-blk: improve handling of DMA mapping failures Halil Pasic
2020-02-13 12:37 ` [PATCH 1/2] virtio-blk: fix hw_queue stopped on arbitrary error Halil Pasic
2020-02-14 18:20 ` dongli.zhang
2020-02-17 13:08 ` Halil Pasic
2020-02-18 2:21 ` Ming Lei
2020-02-18 12:35 ` Halil Pasic
2020-02-19 1:46 ` Ming Lei
2020-02-19 15:42 ` Halil Pasic
2020-02-13 12:37 ` Halil Pasic [this message]
2020-02-19 15:11 ` [PATCH 0/2] virtio-blk: improve handling of DMA mapping failures Stefan Hajnoczi
2020-03-03 14:12 ` Halil Pasic
2020-03-03 14:49 ` Michael S. Tsirkin
2020-03-03 17:02 ` Halil Pasic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200213123728.61216-3-pasic@linux.ibm.com \
--to=pasic@linux.ibm.com \
--cc=Thomas.Lendacky@amd.com \
--cc=axboe@kernel.dk \
--cc=bauerman@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=jasowang@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linuxram@us.ibm.com \
--cc=mihajlov@linux.ibm.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).