[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 7/8] qemu-option: add I/O hang timeout option
From: |
Jiahui Cen |
Subject: |
[RFC PATCH v2 7/8] qemu-option: add I/O hang timeout option |
Date: |
Wed, 30 Sep 2020 17:46:05 +0800 |
I/O hang timeout should be different under different situations. So it is
better to provide an option for user to determine I/O hang timeout for
each block device.
Signed-off-by: Jiahui Cen <cenjiahui@huawei.com>
Signed-off-by: Ying Fang <fangying1@huawei.com>
---
blockdev.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/blockdev.c b/blockdev.c
index bebd3ba1c3..127a7ea894 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -500,6 +500,7 @@ static BlockBackend *blockdev_init(const char *file, QDict
*bs_opts,
BlockdevDetectZeroesOptions detect_zeroes =
BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF;
const char *throttling_group = NULL;
+ int64_t iohang_timeout = 0;
/* Check common options by copying from bs_opts to opts, all other options
* stay in bs_opts for processing by bdrv_open(). */
@@ -622,6 +623,12 @@ static BlockBackend *blockdev_init(const char *file, QDict
*bs_opts,
bs->detect_zeroes = detect_zeroes;
+ /* init timeout value for I/O Hang */
+ iohang_timeout = qemu_opt_get_number(opts, "iohang-timeout", 0);
+ if (iohang_timeout > 0) {
+ blk_iohang_init(blk, iohang_timeout);
+ }
+
block_acct_setup(blk_get_stats(blk), account_invalid, account_failed);
if (!parse_stats_intervals(blk_get_stats(blk), interval_list, errp)) {
@@ -3786,6 +3793,10 @@ QemuOptsList qemu_common_drive_opts = {
.type = QEMU_OPT_BOOL,
.help = "whether to account for failed I/O operations "
"in the statistics",
+ },{
+ .name = "iohang-timeout",
+ .type = QEMU_OPT_NUMBER,
+ .help = "timeout value for I/O Hang",
},
{ /* end of list */ }
},
--
2.28.0
- [RFC PATCH v2 0/8] block-backend: Introduce I/O hang, Jiahui Cen, 2020/09/30
- [RFC PATCH v2 1/8] block-backend: introduce I/O rehandle info, Jiahui Cen, 2020/09/30
- [RFC PATCH v2 3/8] block-backend: add I/O hang timeout, Jiahui Cen, 2020/09/30
- [RFC PATCH v2 5/8] block-backend: enable I/O hang when timeout is set, Jiahui Cen, 2020/09/30
- [RFC PATCH v2 6/8] virtio-blk: pause I/O hang when resetting, Jiahui Cen, 2020/09/30
- [RFC PATCH v2 2/8] block-backend: rehandle block aios when EIO, Jiahui Cen, 2020/09/30
- [RFC PATCH v2 4/8] block-backend: add I/O rehandle pause/unpause, Jiahui Cen, 2020/09/30
- [RFC PATCH v2 7/8] qemu-option: add I/O hang timeout option,
Jiahui Cen <=
- [RFC PATCH v2 8/8] qapi: add I/O hang and I/O hang timeout qapi event, Jiahui Cen, 2020/09/30