[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 1/7] block-backend: introduce I/O rehandle info
From: |
Ying Fang |
Subject: |
[RFC PATCH 1/7] block-backend: introduce I/O rehandle info |
Date: |
Sun, 27 Sep 2020 21:04:14 +0800 |
The I/O hang feature is realized based on a rehandle mechanism.
Each block backend will have a list to store hanging block AIOs,
and a timer to regularly resend these aios. In order to issue
the AIOs again, each block AIOs also need to store its coroutine entry.
Signed-off-by: Jiahui Cen <cenjiahui@huawei.com>
Signed-off-by: Ying Fang <fangying1@huawei.com>
---
block/block-backend.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/block/block-backend.c b/block/block-backend.c
index 24dd0670d1..bf104a7cf5 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -35,6 +35,18 @@
static AioContext *blk_aiocb_get_aio_context(BlockAIOCB *acb);
+/* block backend rehandle timer interval 5s */
+#define BLOCK_BACKEND_REHANDLE_TIMER_INTERVAL 5000
+
+typedef struct BlockBackendRehandleInfo {
+ bool enable;
+ QEMUTimer *ts;
+ unsigned timer_interval_ms;
+
+ unsigned int in_flight;
+ QTAILQ_HEAD(, BlkAioEmAIOCB) re_aios;
+} BlockBackendRehandleInfo;
+
typedef struct BlockBackendAioNotifier {
void (*attached_aio_context)(AioContext *new_context, void *opaque);
void (*detach_aio_context)(void *opaque);
@@ -95,6 +107,8 @@ struct BlockBackend {
* Accessed with atomic ops.
*/
unsigned int in_flight;
+
+ BlockBackendRehandleInfo reinfo;
};
typedef struct BlockBackendAIOCB {
@@ -350,6 +364,7 @@ BlockBackend *blk_new(AioContext *ctx, uint64_t perm,
uint64_t shared_perm)
qemu_co_queue_init(&blk->queued_requests);
notifier_list_init(&blk->remove_bs_notifiers);
notifier_list_init(&blk->insert_bs_notifiers);
+
QLIST_INIT(&blk->aio_notifiers);
QTAILQ_INSERT_TAIL(&block_backends, blk, link);
@@ -1392,6 +1407,10 @@ typedef struct BlkAioEmAIOCB {
BlkRwCo rwco;
int bytes;
bool has_returned;
+
+ /* for rehandle */
+ CoroutineEntry *co_entry;
+ QTAILQ_ENTRY(BlkAioEmAIOCB) list;
} BlkAioEmAIOCB;
static AioContext *blk_aio_em_aiocb_get_aio_context(BlockAIOCB *acb_)
--
2.23.0
- [RFC PATCH 0/7] block-backend: Introduce I/O hang, Ying Fang, 2020/09/27
- [RFC PATCH 6/7] qemu-option: add I/O hang timeout option, Ying Fang, 2020/09/27
- [RFC PATCH 7/7] qapi: add I/O hang and I/O hang timeout qapi event, Ying Fang, 2020/09/27
- [RFC PATCH 1/7] block-backend: introduce I/O rehandle info,
Ying Fang <=
- [RFC PATCH 4/7] block-backend: add I/O hang drain when disbale, Ying Fang, 2020/09/27
- [RFC PATCH 2/7] block-backend: rehandle block aios when EIO, Ying Fang, 2020/09/27
- [RFC PATCH 3/7] block-backend: add I/O hang timeout, Ying Fang, 2020/09/27
- [RFC PATCH 5/7] virtio-blk: disable I/O hang when resetting, Ying Fang, 2020/09/27
- Re: [RFC PATCH 0/7] block-backend: Introduce I/O hang, no-reply, 2020/09/27
- Re: [RFC PATCH 0/7] block-backend: Introduce I/O hang, no-reply, 2020/09/27
- Re: [RFC PATCH 0/7] block-backend: Introduce I/O hang, Kevin Wolf, 2020/09/28