[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 12/12] block: Consider all child nodes in bdrv_reques
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 12/12] block: Consider all child nodes in bdrv_requests_pending() |
Date: |
Thu, 29 Oct 2015 18:09:25 +0000 |
From: Kevin Wolf <address@hidden>
The function manually recursed into bs->file and bs->backing to check
whether there were any requests pending, but it ignored other children.
There's no need to special case file and backing here, so just replace
these two explicit recursions by a loop recursing for all child nodes.
Reported-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/io.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/block/io.c b/block/io.c
index 5ac6256..8dcad3b 100644
--- a/block/io.c
+++ b/block/io.c
@@ -216,6 +216,8 @@ void bdrv_disable_copy_on_read(BlockDriverState *bs)
/* Check if any requests are in-flight (including throttled requests) */
bool bdrv_requests_pending(BlockDriverState *bs)
{
+ BdrvChild *child;
+
if (!QLIST_EMPTY(&bs->tracked_requests)) {
return true;
}
@@ -225,12 +227,13 @@ bool bdrv_requests_pending(BlockDriverState *bs)
if (!qemu_co_queue_empty(&bs->throttled_reqs[1])) {
return true;
}
- if (bs->file && bdrv_requests_pending(bs->file->bs)) {
- return true;
- }
- if (bs->backing && bdrv_requests_pending(bs->backing->bs)) {
- return true;
+
+ QLIST_FOREACH(child, &bs->children, next) {
+ if (bdrv_requests_pending(child->bs)) {
+ return true;
+ }
}
+
return false;
}
--
2.4.3
- [Qemu-devel] [PULL 01/12] qemu-gdb: allow using glibc_pointer_guard() on core dumps, (continued)
- [Qemu-devel] [PULL 01/12] qemu-gdb: allow using glibc_pointer_guard() on core dumps, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 02/12] qemu-gdb: extract parts of "qemu coroutine" implementation, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 04/12] s390x: include HW_COMPAT_* props, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 06/12] virtio-blk: switch off scsi-passthrough by default, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 03/12] qemu-gdb: add $qemu_coroutine_sp and $qemu_coroutine_pc, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 05/12] ppc/spapr: add 2.4 compat props, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 07/12] gdb command: qemu handlers, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 08/12] virtio: sync the dataplane vring state to the virtqueue before virtio_save, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 11/12] target-arm: xlnx-zynqmp: Add sdhci support., Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 10/12] sdhci: Split sdhci.h for public and internal device usage, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 12/12] block: Consider all child nodes in bdrv_requests_pending(),
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 09/12] sd.h: Move sd.h to include/hw/sd/, Stefan Hajnoczi, 2015/10/29
- Re: [Qemu-devel] [PULL 00/12] Block patches, Peter Maydell, 2015/10/30