[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 1/1] block: Don't poll for drain end
From: |
Fam Zheng |
Subject: |
[Qemu-block] [PATCH 1/1] block: Don't poll for drain end |
Date: |
Fri, 24 Nov 2017 01:57:47 +0800 |
Only drained_begin cares about in flight requests are processed, there
is no need to do BDRV_POLL_WHILE() if begin==false, because all that
need to be done is recursively invoking children's callbacks.
Signed-off-by: Fam Zheng <address@hidden>
---
block/io.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/block/io.c b/block/io.c
index 4fdf93a014..55256c130b 100644
--- a/block/io.c
+++ b/block/io.c
@@ -192,13 +192,15 @@ static void bdrv_drain_invoke(BlockDriverState *bs, bool
begin)
static bool bdrv_drain_recurse(BlockDriverState *bs, bool begin)
{
BdrvChild *child, *tmp;
- bool waited;
+ bool waited = false;
/* Ensure any pending metadata writes are submitted to bs->file. */
bdrv_drain_invoke(bs, begin);
- /* Wait for drained requests to finish */
- waited = BDRV_POLL_WHILE(bs, atomic_read(&bs->in_flight) > 0);
+ if (begin) {
+ /* Wait for drained requests to finish */
+ waited = BDRV_POLL_WHILE(bs, atomic_read(&bs->in_flight) > 0);
+ }
QLIST_FOREACH_SAFE(child, &bs->children, next, tmp) {
BlockDriverState *bs = child->bs;
--
2.14.3