mirror: do not increase offset during initial zero_or_discard phase
PATCH 1/1 mirror: do not increase offset during initial zero_or_discard phase
From: Anton Nefedov <[email protected]>
If explicit zeroing out before mirroring is required for the target image, it moves the block job offset counter to EOF, then offset and len counters count the image size twice. There is no harm but stats are confusing, specifically the progress of the operation is always reported as 99% by management tools.
The patch skips offset increase for the first "technical" pass over the image. This should not cause any further harm.
--- block/mirror.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
block/mirror.c +7 -1
@@ -69,6 +69,7 @@ typedef struct MirrorBlockJob {bool waiting_for_io;int target_cluster_sectors;int max_iov; +bool init_pass; } MirrorBlockJob; typedef struct MirrorOp {
@@ -117,7 +118,9 @@ static void mirror_iteration_done(MirrorOp *op, int ret)if (s->cow_bitmap) {bitmap_set (s->cow_bitmap, chunk_num, nb_chunks); } - s->common.offset += (uint64_t )op->nb_sectors *BDRV_SECTOR_SIZE ; +if (!s->init_pass) { + s->common.offset += (uint64_t )op->nb_sectors *BDRV_SECTOR_SIZE ; + } }qemu_iovec_destroy (&op->qiov);
@@ -566,6 +569,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s)return 0 ; } + s->init_pass = true;for (sector_num =0 ; sector_num < end; ) {int nb_sectors =MIN (end - sector_num,QEMU_ALIGN_DOWN (INT_MAX , s->granularity) >>BDRV_SECTOR_BITS );
@@ -573,6 +577,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s)mirror_throttle (s);if (block_job_is_cancelled (&s->common)) { + s->init_pass = false;return 0 ; }
@@ -587,6 +592,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s) }mirror_wait_for_all_io (s); + s->init_pass = false; }/* First part, loop on the sectors and initialize the dirty bitmap. */
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase - pls consider this as V3 patch
Quoted 11 lines · Denis V. Lunev
From: Anton Nefedov <[email protected]>
If explicit zeroing out before mirroring is required for the target image, it moves the block job offset counter to EOF, then offset and len counters count the image size twice. There is no harm but stats are confusing, specifically the progress of the operation is always reported as 99% by management tools.
The patch skips offset increase for the first "technical" pass over the image. This should not cause any further harm.
Quoted 7 lines
Signed-off-by Anton Nefedov <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>Reviewed-by Eric Blake <[email protected]>Reviewed-by Stefan Hajnoczi <[email protected]>CC Jeff Cody <[email protected]>CC Kevin Wolf <[email protected]>CC Max Reitz <[email protected]>
actually this is V3 patch. Sorry for broken subject.
Den
Re: [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase - pls consider this as V3 patch
Quoted 19 lines · Denis V. Lunev
Quoted 11 lines · Denis V. Lunev
From: Anton Nefedov <[email protected]>
If explicit zeroing out before mirroring is required for the target image, it moves the block job offset counter to EOF, then offset and len counters count the image size twice. There is no harm but stats are confusing, specifically the progress of the operation is always reported as 99% by management tools.
The patch skips offset increase for the first "technical" pass over the image. This should not cause any further harm.
Quoted 7 lines
Signed-off-by Anton Nefedov <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>Reviewed-by Eric Blake <[email protected]>Reviewed-by Stefan Hajnoczi <[email protected]>CC Jeff Cody <[email protected]>CC Kevin Wolf <[email protected]>CC Max Reitz <[email protected]>
Quoted 3 lines
actually this is V3 patch. Sorry for broken subject.
Den
ping
Re: [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase - pls consider this as V3 patch
Quoted 20 lines · Denis V. Lunev
Quoted 19 lines · Denis V. Lunev
Quoted 18 lines · Denis V. Lunev
From: Anton Nefedov <[email protected]>
If explicit zeroing out before mirroring is required for the target image, it moves the block job offset counter to EOF, then offset and len counters count the image size twice. There is no harm but stats are confusing, specifically the progress of the operation is always reported as 99% by management tools.
The patch skips offset increase for the first "technical" pass over the image. This should not cause any further harm.
Signed-off-by Anton Nefedov <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>Reviewed-by Eric Blake <[email protected]>Reviewed-by Stefan Hajnoczi <[email protected]>CC Jeff Cody <[email protected]>CC Kevin Wolf <[email protected]>CC Max Reitz <[email protected]>
Quoted 4 lines
Quoted 3 lines
actually this is V3 patch. Sorry for broken subject.
Den
ping
Didn't Jeff merge v2?
http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg01319.html
Max
Re: [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase - pls consider this as V3 patch
Quoted 23 lines · Max Reitz
Quoted 22 lines · Denis V. Lunev
Quoted 21 lines · Denis V. Lunev
Quoted 11 lines · Denis V. Lunev
From: Anton Nefedov <[email protected]>
If explicit zeroing out before mirroring is required for the target image, it moves the block job offset counter to EOF, then offset and len counters count the image size twice. There is no harm but stats are confusing, specifically the progress of the operation is always reported as 99% by management tools.
The patch skips offset increase for the first "technical" pass over the image. This should not cause any further harm.
Quoted 7 lines
Signed-off-by Anton Nefedov <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>Reviewed-by Eric Blake <[email protected]>Reviewed-by Stefan Hajnoczi <[email protected]>CC Jeff Cody <[email protected]>CC Kevin Wolf <[email protected]>CC Max Reitz <[email protected]>actually this is V3 patch. Sorry for broken subject.
Quoted 9 lines
Quoted 2 lines
Quoted 1 line
Den
ping
Didn't Jeff merge v2?
http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg01319.html
Max
Yes, I did.
Re: [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase - pls consider this as V3 patch
Quoted 26 lines · Jeff Cody
Quoted 25 lines · Max Reitz
Quoted 24 lines · Denis V. Lunev
Quoted 19 lines · Denis V. Lunev
Quoted 11 lines · Denis V. Lunev
From: Anton Nefedov <[email protected]>
If explicit zeroing out before mirroring is required for the target image, it moves the block job offset counter to EOF, then offset and len counters count the image size twice. There is no harm but stats are confusing, specifically the progress of the operation is always reported as 99% by management tools.
The patch skips offset increase for the first "technical" pass over the image. This should not cause any further harm.
Quoted 7 lines
Signed-off-by Anton Nefedov <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>Reviewed-by Eric Blake <[email protected]>Reviewed-by Stefan Hajnoczi <[email protected]>CC Jeff Cody <[email protected]>CC Kevin Wolf <[email protected]>CC Max Reitz <[email protected]>Quoted 3 lines
actually this is V3 patch. Sorry for broken subject.
Den
ping
Quoted 8 lines
Quoted 6 lines
Didn't Jeff merge v2?
http://lists.nongnu.org/archive/html/qemu-devel/2017-02/msg01319.html
Max
Yes, I did.
thank you very much for clarification
Den