代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/qemu 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From f3158cc327d435939d87ecee23485d082ebf3ba2 Mon Sep 17 00:00:00 2001
From: Jiahui Cen <cenjiahui@huawei.com>
Date: Thu, 21 Jan 2021 15:46:53 +0800
Subject: [PATCH] virtio_blk: Add support for retry on errors
Insert failed requests into device's list for later retry and handle
queued requests to implement retry_request_cb.
Signed-off-by: Jiahui Cen <cenjiahui(a)huawei.com>
Signed-off-by: Ying Fang <fangying1(a)huawei.com>
---
hw/block/virtio-blk.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index ddf525b9d7..2db9804cfe 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -101,6 +101,10 @@ static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error,
block_acct_failed(blk_get_stats(s->blk), &req->acct);
}
virtio_blk_free_request(req);
+ } else if (action == BLOCK_ERROR_ACTION_RETRY) {
+ req->mr_next = NULL;
+ req->next = s->rq;
+ s->rq = req;
}
blk_error_action(s->blk, action, is_read, error);
@@ -142,6 +146,7 @@ static void virtio_blk_rw_complete(void *opaque, int ret)
}
}
+ blk_error_retry_reset_timeout(s->blk);
virtio_blk_req_complete(req, VIRTIO_BLK_S_OK);
block_acct_done(blk_get_stats(s->blk), &req->acct);
virtio_blk_free_request(req);
@@ -161,6 +166,7 @@ static void virtio_blk_flush_complete(void *opaque, int ret)
}
}
+ blk_error_retry_reset_timeout(s->blk);
virtio_blk_req_complete(req, VIRTIO_BLK_S_OK);
block_acct_done(blk_get_stats(s->blk), &req->acct);
virtio_blk_free_request(req);
@@ -183,6 +189,7 @@ static void virtio_blk_discard_write_zeroes_complete(void *opaque, int ret)
}
}
+ blk_error_retry_reset_timeout(s->blk);
virtio_blk_req_complete(req, VIRTIO_BLK_S_OK);
if (is_write_zeroes) {
block_acct_done(blk_get_stats(s->blk), &req->acct);
@@ -811,12 +818,12 @@ static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
void virtio_blk_process_queued_requests(VirtIOBlock *s, bool is_bh)
{
- VirtIOBlockReq *req = s->rq;
+ VirtIOBlockReq *req;
MultiReqBuffer mrb = {};
- s->rq = NULL;
-
aio_context_acquire(blk_get_aio_context(s->conf.conf.blk));
+ req = s->rq;
+ s->rq = NULL;
while (req) {
VirtIOBlockReq *next = req->next;
if (virtio_blk_handle_request(req, &mrb)) {
@@ -1101,8 +1108,16 @@ static void virtio_blk_resize(void *opaque)
virtio_notify_config(vdev);
}
+static void virtio_blk_retry_request(void *opaque)
+{
+ VirtIOBlock *s = VIRTIO_BLK(opaque);
+
+ virtio_blk_process_queued_requests(s, false);
+}
+
static const BlockDevOps virtio_block_ops = {
.resize_cb = virtio_blk_resize,
+ .retry_request_cb = virtio_blk_retry_request,
};
static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。