代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/qemu 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 9567fce96050342f393f546d3c5131118c3cad7c Mon Sep 17 00:00:00 2001
From: yexiao <[email protected]>
Date: Thu, 21 Jan 2021 15:46:46 +0800
Subject: [PATCH] block-backend: Introduce retry timer
Add a timer to regularly trigger retry on errors.
Signed-off-by: Jiahui Cen <cenjiahui(a)huawei.com>
Signed-off-by: Ying Fang <fangying1(a)huawei.com>
Signed-off-by: Alex Chen <[email protected]>
---
block/block-backend.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/block/block-backend.c b/block/block-backend.c
index ec21148806..2f56cc8382 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -33,6 +33,9 @@
#define NOT_DONE 0x7fffffff /* used while emulated sync operation in progress */
+/* block backend default retry interval */
+#define BLOCK_BACKEND_DEFAULT_RETRY_INTERVAL 1000
+
typedef struct BlockBackendAioNotifier {
void (*attached_aio_context)(AioContext *new_context, void *opaque);
void (*detach_aio_context)(void *opaque);
@@ -92,6 +95,15 @@ struct BlockBackend {
* Accessed with atomic ops.
*/
unsigned int in_flight;
+
+ /* Timer for retry on errors. */
+ QEMUTimer *retry_timer;
+ /* Interval in ms to trigger next retry. */
+ int64_t retry_interval;
+ /* Start time of the first error. Used to check timeout. */
+ int64_t retry_start_time;
+ /* Retry timeout. 0 represents infinite retry. */
+ int64_t retry_timeout;
};
typedef struct BlockBackendAIOCB {
@@ -368,6 +380,11 @@ BlockBackend *blk_new(AioContext *ctx, uint64_t perm, uint64_t shared_perm)
blk->on_read_error = BLOCKDEV_ON_ERROR_REPORT;
blk->on_write_error = BLOCKDEV_ON_ERROR_ENOSPC;
+ blk->retry_timer = NULL;
+ blk->retry_interval = BLOCK_BACKEND_DEFAULT_RETRY_INTERVAL;
+ blk->retry_start_time = 0;
+ blk->retry_timeout = 0;
+
block_acct_init(&blk->stats);
qemu_mutex_init(&blk->queued_requests_lock);
@@ -508,6 +525,10 @@ static void blk_delete(BlockBackend *blk)
QTAILQ_REMOVE(&block_backends, blk, link);
drive_info_del(blk->legacy_dinfo);
block_acct_cleanup(&blk->stats);
+ if (blk->retry_timer) {
+ timer_del(blk->retry_timer);
+ timer_free(blk->retry_timer);
+ }
g_free(blk);
}
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。