From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Manos Pitsidianakis <el13635@mail.ntua.gr>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PULL 3/3] block/throttle.c: add bdrv_co_drain_begin/end callbacks
Date: Fri, 13 Oct 2017 14:49:30 +0100 [thread overview]
Message-ID: <20171013134930.20200-4-stefanha@redhat.com> (raw)
In-Reply-To: <20171013134930.20200-1-stefanha@redhat.com>
From: Manos Pitsidianakis <el13635@mail.ntua.gr>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/throttle.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/block/throttle.c b/block/throttle.c
index 5bca76300f..833175ac77 100644
--- a/block/throttle.c
+++ b/block/throttle.c
@@ -197,6 +197,21 @@ static bool throttle_recurse_is_first_non_filter(BlockDriverState *bs,
return bdrv_recurse_is_first_non_filter(bs->file->bs, candidate);
}
+static void coroutine_fn throttle_co_drain_begin(BlockDriverState *bs)
+{
+ ThrottleGroupMember *tgm = bs->opaque;
+ if (atomic_fetch_inc(&tgm->io_limits_disabled) == 0) {
+ throttle_group_restart_tgm(tgm);
+ }
+}
+
+static void coroutine_fn throttle_co_drain_end(BlockDriverState *bs)
+{
+ ThrottleGroupMember *tgm = bs->opaque;
+ assert(tgm->io_limits_disabled);
+ atomic_dec(&tgm->io_limits_disabled);
+}
+
static BlockDriver bdrv_throttle = {
.format_name = "throttle",
.protocol_name = "throttle",
@@ -226,6 +241,9 @@ static BlockDriver bdrv_throttle = {
.bdrv_reopen_abort = throttle_reopen_abort,
.bdrv_co_get_block_status = bdrv_co_get_block_status_from_file,
+ .bdrv_co_drain_begin = throttle_co_drain_begin,
+ .bdrv_co_drain_end = throttle_co_drain_end,
+
.is_filter = true,
};
--
2.13.6
next prev parent reply other threads:[~2017-10-13 13:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 13:49 [Qemu-devel] [PULL 0/3] Block patches Stefan Hajnoczi
2017-10-13 13:49 ` [Qemu-devel] [PULL 1/3] block: add bdrv_co_drain_end callback Stefan Hajnoczi
2017-10-13 13:49 ` [Qemu-devel] [PULL 2/3] block: rename bdrv_co_drain to bdrv_co_drain_begin Stefan Hajnoczi
2017-10-13 13:49 ` Stefan Hajnoczi [this message]
2017-10-16 14:54 ` [Qemu-devel] [PULL 0/3] Block patches Peter Maydell
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=20171013134930.20200-4-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=el13635@mail.ntua.gr \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).