[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/47] mirror: Go through ready -> complete process f
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 02/47] mirror: Go through ready -> complete process for 0 len image |
Date: |
Fri, 27 Jun 2014 21:08:21 +0200 |
From: Fam Zheng <address@hidden>
When mirroring or active committing a zero length image, BLOCK_JOB_READY
is not reported now, instead the job completes because we short circuit
the mirror job loop.
This is inconsistent with non-zero length images, and only confuses
management software.
Let's do the same thing when seeing a 0-length image: report ready
immediately; wait for block-job-cancel or block-job-complete; clear the
cancel flag as existing non-zero image synced case (cancelled after
ready); then jump to the exit.
Reported-by: Eric Blake <address@hidden>
Signed-off-by: Fam Zheng <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/mirror.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/block/mirror.c b/block/mirror.c
index 301a04d..7c9f898 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -324,9 +324,18 @@ static void coroutine_fn mirror_run(void *opaque)
}
s->common.len = bdrv_getlength(bs);
- if (s->common.len <= 0) {
+ if (s->common.len < 0) {
ret = s->common.len;
goto immediate_exit;
+ } else if (s->common.len == 0) {
+ /* Report BLOCK_JOB_READY and wait for complete. */
+ block_job_event_ready(&s->common);
+ s->synced = true;
+ while (!block_job_is_cancelled(&s->common) && !s->should_complete) {
+ block_job_yield(&s->common);
+ }
+ s->common.cancelled = false;
+ goto immediate_exit;
}
length = DIV_ROUND_UP(s->common.len, s->granularity);
--
1.8.3.1
- [Qemu-devel] [PULL 00/47] Block patches for 2.1.0-rc0, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 01/47] blockjob: Add block_job_yield(), Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 02/47] mirror: Go through ready -> complete process for 0 len image,
Kevin Wolf <=
- [Qemu-devel] [PULL 06/47] block/nfs: add knob to set readahead, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 05/47] block/nfs: fix url parameter checking, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 03/47] qemu-iotests: Test BLOCK_JOB_READY event for 0Kb image active commit, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 04/47] qemu-iotests: Test 0-length image for mirror, Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 08/47] block: Move bdrv_fill_options() call to bdrv_open(), Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 07/47] block: Create bdrv_fill_options(), Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 09/47] block: Move json: parsing to bdrv_fill_options(), Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 11/47] block: Use common driver selection code for bdrv_open_file(), Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 12/47] block: Inline bdrv_file_open(), Kevin Wolf, 2014/06/27
- [Qemu-devel] [PULL 10/47] block: Always pass driver name through options QDict, Kevin Wolf, 2014/06/27