From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 7/7] block: add the support to drain throttled requests
Date: Mon, 12 Mar 2012 19:22:28 +0100 [thread overview]
Message-ID: <1331576548-23067-8-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1331576548-23067-1-git-send-email-pbonzini@redhat.com>
From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
[ Iterate until all block devices have processed all requests,
add comments. - Paolo ]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
block.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/block.c b/block.c
index dac62a1..0d769a6 100644
--- a/block.c
+++ b/block.c
@@ -858,12 +858,31 @@ void bdrv_close_all(void)
*
* This function does not flush data to disk, use bdrv_flush_all() for that
* after calling this function.
+ *
+ * Note that completion of an asynchronous I/O operation can trigger any
+ * number of other I/O operations on other devices---for example a coroutine
+ * can be arbitrarily complex and a constant flow of I/O to multiple devices
+ * can come until the coroutine is complete. Because of this, it is not
+ * possible to drain a single device's I/O queue.
*/
void bdrv_drain_all(void)
{
BlockDriverState *bs;
+ bool busy;
- qemu_aio_flush();
+ do {
+ busy = qemu_aio_wait();
+
+ /* FIXME: We do not have timer support here, so this is effectively
+ * a busy wait.
+ */
+ QTAILQ_FOREACH(bs, &bdrv_states, list) {
+ if (!qemu_co_queue_empty(&bs->throttled_reqs)) {
+ qemu_co_queue_restart_all(&bs->throttled_reqs);
+ busy = true;
+ }
+ }
+ } while (busy);
/* If requests are still pending there is a bug somewhere */
QTAILQ_FOREACH(bs, &bdrv_states, list) {
--
1.7.7.6
next prev parent reply other threads:[~2012-03-12 18:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-12 18:22 [Qemu-devel] [PATCH 0/7] AIO nested loop and bdrv_drain_all changes Paolo Bonzini
2012-03-12 18:22 ` [Qemu-devel] [PATCH 1/7] qemu-io: use main_loop_wait Paolo Bonzini
2012-03-12 18:22 ` [Qemu-devel] [PATCH 2/7] qemu-tool: map vm_clock to rt_clock Paolo Bonzini
2012-03-12 18:22 ` [Qemu-devel] [PATCH 3/7] posix-aio: merge posix_aio_process_queue and posix_aio_read Paolo Bonzini
2012-03-12 18:22 ` [Qemu-devel] [PATCH 4/7] aio: remove process_queue callback and qemu_aio_process_queue Paolo Bonzini
2012-03-12 18:22 ` [Qemu-devel] [PATCH 5/7] aio: return "AIO in progress" state from qemu_aio_wait Paolo Bonzini
2012-03-12 18:22 ` [Qemu-devel] [PATCH 6/7] aio: simplify qemu_aio_wait Paolo Bonzini
2012-03-12 18:22 ` Paolo Bonzini [this message]
2012-03-13 1:38 ` [Qemu-devel] [PATCH 7/7] block: add the support to drain throttled requests Zhi Yong Wu
2012-03-13 1:46 ` Zhi Yong Wu
2012-03-13 1:56 ` Zhi Yong Wu
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=1331576548-23067-8-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wuzhy@linux.vnet.ibm.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).