From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
Peter Maydell <peter.maydell@linaro.org>,
Thomas Huth <thuth@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Laurent Vivier <lvivier@redhat.com>,
Max Reitz <mreitz@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>,
Pankaj Gupta <pagupta@redhat.com>
Subject: [Qemu-devel] [PULL 4/9] virtio-blk: add acct_failed param to virtio_blk_handle_rw_error()
Date: Mon, 11 Feb 2019 13:50:35 +0800 [thread overview]
Message-ID: <20190211055040.13528-5-stefanha@redhat.com> (raw)
In-Reply-To: <20190211055040.13528-1-stefanha@redhat.com>
From: Stefano Garzarella <sgarzare@redhat.com>
We add acct_failed param in order to use virtio_blk_handle_rw_error()
also when is not required to call block_acct_failed(). (eg. a discard
operation is failed)
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Pankaj Gupta <pagupta@redhat.com>
Message-id: 20190208134950.187665-2-sgarzare@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/block/virtio-blk.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 843bb2bec8..c95a6f4c9b 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -61,7 +61,7 @@ static void virtio_blk_req_complete(VirtIOBlockReq *req, unsigned char status)
}
static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error,
- bool is_read)
+ bool is_read, bool acct_failed)
{
VirtIOBlock *s = req->dev;
BlockErrorAction action = blk_get_error_action(s->blk, is_read, error);
@@ -74,7 +74,9 @@ static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error,
s->rq = req;
} else if (action == BLOCK_ERROR_ACTION_REPORT) {
virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR);
- block_acct_failed(blk_get_stats(s->blk), &req->acct);
+ if (acct_failed) {
+ block_acct_failed(blk_get_stats(s->blk), &req->acct);
+ }
virtio_blk_free_request(req);
}
@@ -112,7 +114,7 @@ static void virtio_blk_rw_complete(void *opaque, int ret)
* the memory until the request is completed (which will
* happen on the other side of the migration).
*/
- if (virtio_blk_handle_rw_error(req, -ret, is_read)) {
+ if (virtio_blk_handle_rw_error(req, -ret, is_read, true)) {
continue;
}
}
@@ -131,7 +133,7 @@ static void virtio_blk_flush_complete(void *opaque, int ret)
aio_context_acquire(blk_get_aio_context(s->conf.conf.blk));
if (ret) {
- if (virtio_blk_handle_rw_error(req, -ret, 0)) {
+ if (virtio_blk_handle_rw_error(req, -ret, 0, true)) {
goto out;
}
}
--
2.20.1
next prev parent reply other threads:[~2019-02-11 5:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-11 5:50 [Qemu-devel] [PULL 0/9] Block patches Stefan Hajnoczi
2019-02-11 5:50 ` [Qemu-devel] [PULL 1/9] iothread: fix iothread hang when stop too soon Stefan Hajnoczi
2019-02-11 5:50 ` [Qemu-devel] [PULL 2/9] qemugdb/coroutine: fix arch_prctl has unknown return type Stefan Hajnoczi
2019-02-11 5:50 ` [Qemu-devel] [PULL 3/9] virtio-blk: cleanup using VirtIOBlock *s and VirtIODevice *vdev Stefan Hajnoczi
2019-02-11 5:50 ` Stefan Hajnoczi [this message]
2019-02-11 5:50 ` [Qemu-devel] [PULL 5/9] virtio-blk: add host_features field in VirtIOBlock Stefan Hajnoczi
2019-02-11 5:50 ` [Qemu-devel] [PULL 6/9] virtio-blk: add "discard" and "write-zeroes" properties Stefan Hajnoczi
2019-02-11 5:50 ` [Qemu-devel] [PULL 7/9] virtio-blk: add DISCARD and WRITE_ZEROES features Stefan Hajnoczi
2019-02-11 5:50 ` [Qemu-devel] [PULL 8/9] tests/virtio-blk: change assert on data_size in virtio_blk_request() Stefan Hajnoczi
2019-02-11 5:50 ` [Qemu-devel] [PULL 9/9] tests/virtio-blk: add test for WRITE_ZEROES command Stefan Hajnoczi
2019-02-11 11:42 ` [Qemu-devel] [PULL 0/9] Block patches Peter Maydell
2019-02-12 3:51 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2019-02-12 8:11 ` Stefano Garzarella
2019-02-12 9:49 ` Peter Maydell
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=20190211055040.13528-5-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=ehabkost@redhat.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pagupta@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=thuth@redhat.com \
/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).