[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 28/39] block: use the block job list in bdrv_drain_al
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 28/39] block: use the block job list in bdrv_drain_all() |
Date: |
Thu, 16 Jun 2016 16:08:17 +0200 |
From: Alberto Garcia <address@hidden>
bdrv_drain_all() pauses all block jobs by using bdrv_next() to iterate
over all top-level BlockDriverStates. Therefore the code is unable to
find block jobs in other nodes.
This patch uses block_job_next() to iterate over all block jobs.
Signed-off-by: Alberto Garcia <address@hidden>
Message-id: address@hidden
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
block/io.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/block/io.c b/block/io.c
index f5ce5f1..ebdb9d8 100644
--- a/block/io.c
+++ b/block/io.c
@@ -289,15 +289,21 @@ void bdrv_drain_all(void)
bool busy = true;
BlockDriverState *bs;
BdrvNextIterator it;
+ BlockJob *job = NULL;
GSList *aio_ctxs = NULL, *ctx;
+ while ((job = block_job_next(job))) {
+ AioContext *aio_context = blk_get_aio_context(job->blk);
+
+ aio_context_acquire(aio_context);
+ block_job_pause(job);
+ aio_context_release(aio_context);
+ }
+
for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
AioContext *aio_context = bdrv_get_aio_context(bs);
aio_context_acquire(aio_context);
- if (bs->job) {
- block_job_pause(bs->job);
- }
bdrv_parent_drained_begin(bs);
bdrv_io_unplugged_begin(bs);
bdrv_drain_recurse(bs);
@@ -340,12 +346,18 @@ void bdrv_drain_all(void)
aio_context_acquire(aio_context);
bdrv_io_unplugged_end(bs);
bdrv_parent_drained_end(bs);
- if (bs->job) {
- block_job_resume(bs->job);
- }
aio_context_release(aio_context);
}
g_slist_free(aio_ctxs);
+
+ job = NULL;
+ while ((job = block_job_next(job))) {
+ AioContext *aio_context = blk_get_aio_context(job->blk);
+
+ aio_context_acquire(aio_context);
+ block_job_resume(job);
+ aio_context_release(aio_context);
+ }
}
/**
--
1.8.3.1
- [Qemu-block] [PULL 10/39] block: Avoid bogus flags during mirroring, (continued)
- [Qemu-block] [PULL 10/39] block: Avoid bogus flags during mirroring, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 11/39] block: Assert that flags are in range, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 20/39] doc: Fix mailing list address in tests/qemu-iotests/README, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 24/39] block: Make bdrv_load/save_vmstate coroutine_fns, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 18/39] block: Don't enforce 512 byte minimum alignment, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 29/39] block: use the block job list in qmp_query_block_jobs(), Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 30/39] block: Prevent sleeping jobs from resuming if they have been paused, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 27/39] block: Fix snapshot=on with aio=native, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 25/39] qcow2: Let vmstate call qcow2_co_preadv/pwrite directly, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 22/39] block: Make .bdrv_load_vmstate() vectored, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 28/39] block: use the block job list in bdrv_drain_all(),
Kevin Wolf <=
- [Qemu-block] [PULL 32/39] iotests: 095: Clean up QEMU before showing image info, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 31/39] block: Create the commit block job before reopening any image, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 26/39] block: Remove bs->zero_beyond_eof, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 38/39] iotests: Add test for oVirt-like storage migration, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 37/39] iotests: Add test for post-mirror backing chains, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 33/39] rbd:change error_setg() to error_setg_errno(), Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 34/39] block: Allow replacement of a BDS by its overlay, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 39/39] hbitmap: add 'pos < size' asserts, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 35/39] block/mirror: Fix target backing BDS, Kevin Wolf, 2016/06/16
- [Qemu-block] [PULL 36/39] block/null: Implement bdrv_refresh_filename(), Kevin Wolf, 2016/06/16