[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 18/27] virtio-blk: add acct_failed param to virtio_bl
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-block] [PULL 18/27] virtio-blk: add acct_failed param to virtio_blk_handle_rw_error() |
Date: |
Fri, 22 Feb 2019 14:07:47 +0000 |
From: Stefano Garzarella <address@hidden>
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 <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Stefano Garzarella <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
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 cf7f47eaba..afedf48ca6 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -65,7 +65,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);
@@ -78,7 +78,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);
}
@@ -116,7 +118,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;
}
}
@@ -135,7 +137,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
- [Qemu-block] [PULL 07/27] block/parallels: use QEMU_IOVEC_INIT_BUF, (continued)
- [Qemu-block] [PULL 07/27] block/parallels: use QEMU_IOVEC_INIT_BUF, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 08/27] block/qcow: use qemu_iovec_init_buf, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 09/27] block/qcow2: use qemu_iovec_init_buf, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 13/27] migration/block: use qemu_iovec_init_buf, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 10/27] block/qed: use qemu_iovec_init_buf, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 14/27] tests/test-bdrv-drain: use QEMU_IOVEC_INIT_BUF, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 15/27] hw/ide: drop iov field from IDEState, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 12/27] qemu-img: use qemu_iovec_init_buf, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 22/27] virtio-blk: set config size depending on the features enabled, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 16/27] hw/ide: drop iov field from IDEBufferedRequest, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 18/27] virtio-blk: add acct_failed param to virtio_blk_handle_rw_error(),
Stefan Hajnoczi <=
- [Qemu-block] [PULL 17/27] hw/ide: drop iov field from IDEDMA, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 25/27] tests/virtio-blk: add virtio_blk_fix_dwz_hdr() function, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 26/27] tests/virtio-blk: add test for WRITE_ZEROES command, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 20/27] virtio-blk: add "discard" and "write-zeroes" properties, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 21/27] virtio-net: make VirtIOFeature usable for other virtio devices, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 19/27] virtio-blk: add host_features field in VirtIOBlock, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 23/27] virtio-blk: add DISCARD and WRITE_ZEROES features, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 27/27] tests/virtio-blk: add test for DISCARD command, Stefan Hajnoczi, 2019/02/22
- [Qemu-block] [PULL 24/27] tests/virtio-blk: change assert on data_size in virtio_blk_request(), Stefan Hajnoczi, 2019/02/22
- Re: [Qemu-block] [PULL 00/27] Block patches, Peter Maydell, 2019/02/26