From: Jiahui Cen <cenjiahui@huawei.com>
To: <qemu-devel@nongnu.org>, <kwolf@redhat.com>, <mreitz@redhat.com>,
<eblake@redhat.com>
Cc: cenjiahui@huawei.com, zhang.zhanghailiang@huawei.com,
qemu-block@nongnu.org, stefanha@redhat.com, fangying1@huawei.com,
jsnow@redhat.com
Subject: [PATCH v3 7/9] qemu-option: add I/O hang timeout option
Date: Thu, 22 Oct 2020 21:03:01 +0800 [thread overview]
Message-ID: <20201022130303.1092-8-cenjiahui@huawei.com> (raw)
In-Reply-To: <20201022130303.1092-1-cenjiahui@huawei.com>
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 fe6fb5dc1d..0a77eedfc4 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -501,6 +501,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(). */
@@ -623,6 +624,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)) {
@@ -3796,6 +3803,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.19.1
next prev parent reply other threads:[~2020-10-22 13:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-22 13:02 [PATCH v3 0/9] block-backend: Introduce I/O hang Jiahui Cen
2020-10-22 13:02 ` [PATCH v3 1/9] block-backend: introduce I/O rehandle info Jiahui Cen
2020-10-22 13:02 ` [PATCH v3 2/9] block-backend: rehandle block aios when EIO Jiahui Cen
2020-10-22 13:02 ` [PATCH v3 3/9] block-backend: add I/O hang timeout Jiahui Cen
2020-10-22 13:02 ` [PATCH v3 4/9] block-backend: add I/O rehandle pause/unpause Jiahui Cen
2020-10-22 13:02 ` [PATCH v3 5/9] block-backend: enable I/O hang when timeout is set Jiahui Cen
2020-10-22 13:03 ` [PATCH v3 6/9] virtio-blk: pause I/O hang when resetting Jiahui Cen
2020-10-22 13:03 ` Jiahui Cen [this message]
2020-10-22 13:03 ` [PATCH v3 8/9] qapi: add I/O hang and I/O hang timeout qapi event Jiahui Cen
2020-10-22 13:03 ` [PATCH v3 9/9] docs: add a doc about I/O hang Jiahui Cen
2020-10-26 16:53 ` [PATCH v3 0/9] block-backend: Introduce " Stefan Hajnoczi
2020-10-29 9:42 ` cenjiahui
2020-10-30 13:21 ` Stefan Hajnoczi
2020-11-03 12:19 ` cenjiahui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201022130303.1092-8-cenjiahui@huawei.com \
--to=cenjiahui@huawei.com \
--cc=eblake@redhat.com \
--cc=fangying1@huawei.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=zhang.zhanghailiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).