All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase
@ 2017-02-03 15:06 Denis V. Lunev
  2017-02-03 15:08 ` [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase - pls consider this as V3 patch Denis V. Lunev
  0 siblings, 1 reply; 6+ messages in thread
From: Denis V. Lunev @ 2017-02-03 15:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Anton Nefedov, Denis V . Lunev, Jeff Cody, Kevin Wolf, Max Reitz

From: Anton Nefedov <anton.nefedov@virtuozzo.com>

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 <anton.nefedov@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
CC: Jeff Cody <jcody@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Max Reitz <mreitz@redhat.com>
---
 block/mirror.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/block/mirror.c b/block/mirror.c
index 301ba92..688bc91 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -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.  */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase - pls consider this as V3 patch
  2017-02-03 15:06 [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase Denis V. Lunev
@ 2017-02-03 15:08 ` Denis V. Lunev
  2017-02-13  7:10   ` Denis V. Lunev
  0 siblings, 1 reply; 6+ messages in thread
From: Denis V. Lunev @ 2017-02-03 15:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anton Nefedov, Jeff Cody, Kevin Wolf, Max Reitz

On 02/03/2017 06:06 PM, Denis V. Lunev wrote:
> From: Anton Nefedov <anton.nefedov@virtuozzo.com>
>
> 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 <anton.nefedov@virtuozzo.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> CC: Jeff Cody <jcody@redhat.com>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Max Reitz <mreitz@redhat.com>
actually this is V3 patch. Sorry for broken subject.

Den

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase - pls consider this as V3 patch
  2017-02-03 15:08 ` [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase - pls consider this as V3 patch Denis V. Lunev
@ 2017-02-13  7:10   ` Denis V. Lunev
  2017-02-13 17:16     ` Max Reitz
  0 siblings, 1 reply; 6+ messages in thread
From: Denis V. Lunev @ 2017-02-13  7:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anton Nefedov, Jeff Cody, Kevin Wolf, Max Reitz

On 02/03/2017 06:08 PM, Denis V. Lunev wrote:
> On 02/03/2017 06:06 PM, Denis V. Lunev wrote:
>> From: Anton Nefedov <anton.nefedov@virtuozzo.com>
>>
>> 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 <anton.nefedov@virtuozzo.com>
>> Signed-off-by: Denis V. Lunev <den@openvz.org>
>> Reviewed-by: Eric Blake <eblake@redhat.com>
>> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
>> CC: Jeff Cody <jcody@redhat.com>
>> CC: Kevin Wolf <kwolf@redhat.com>
>> CC: Max Reitz <mreitz@redhat.com>
> actually this is V3 patch. Sorry for broken subject.
>
> Den
ping

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase - pls consider this as V3 patch
  2017-02-13  7:10   ` Denis V. Lunev
@ 2017-02-13 17:16     ` Max Reitz
  2017-02-13 19:13       ` Jeff Cody
  0 siblings, 1 reply; 6+ messages in thread
From: Max Reitz @ 2017-02-13 17:16 UTC (permalink / raw)
  To: Denis V. Lunev, qemu-devel; +Cc: Anton Nefedov, Jeff Cody, Kevin Wolf

[-- Attachment #1: Type: text/plain, Size: 1198 bytes --]

On 13.02.2017 08:10, Denis V. Lunev wrote:
> On 02/03/2017 06:08 PM, Denis V. Lunev wrote:
>> On 02/03/2017 06:06 PM, Denis V. Lunev wrote:
>>> From: Anton Nefedov <anton.nefedov@virtuozzo.com>
>>>
>>> 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 <anton.nefedov@virtuozzo.com>
>>> Signed-off-by: Denis V. Lunev <den@openvz.org>
>>> Reviewed-by: Eric Blake <eblake@redhat.com>
>>> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
>>> CC: Jeff Cody <jcody@redhat.com>
>>> CC: Kevin Wolf <kwolf@redhat.com>
>>> CC: Max Reitz <mreitz@redhat.com>
>> 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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase - pls consider this as V3 patch
  2017-02-13 17:16     ` Max Reitz
@ 2017-02-13 19:13       ` Jeff Cody
  2017-02-13 19:45         ` Denis V. Lunev
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff Cody @ 2017-02-13 19:13 UTC (permalink / raw)
  To: Max Reitz; +Cc: Denis V. Lunev, qemu-devel, Anton Nefedov, Kevin Wolf

On Mon, Feb 13, 2017 at 06:16:36PM +0100, Max Reitz wrote:
> On 13.02.2017 08:10, Denis V. Lunev wrote:
> > On 02/03/2017 06:08 PM, Denis V. Lunev wrote:
> >> On 02/03/2017 06:06 PM, Denis V. Lunev wrote:
> >>> From: Anton Nefedov <anton.nefedov@virtuozzo.com>
> >>>
> >>> 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 <anton.nefedov@virtuozzo.com>
> >>> Signed-off-by: Denis V. Lunev <den@openvz.org>
> >>> Reviewed-by: Eric Blake <eblake@redhat.com>
> >>> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> >>> CC: Jeff Cody <jcody@redhat.com>
> >>> CC: Kevin Wolf <kwolf@redhat.com>
> >>> CC: Max Reitz <mreitz@redhat.com>
> >> 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
> 


Yes, I did.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase - pls consider this as V3 patch
  2017-02-13 19:13       ` Jeff Cody
@ 2017-02-13 19:45         ` Denis V. Lunev
  0 siblings, 0 replies; 6+ messages in thread
From: Denis V. Lunev @ 2017-02-13 19:45 UTC (permalink / raw)
  To: Jeff Cody, Max Reitz; +Cc: qemu-devel, Anton Nefedov, Kevin Wolf

On 02/13/2017 10:13 PM, Jeff Cody wrote:
> On Mon, Feb 13, 2017 at 06:16:36PM +0100, Max Reitz wrote:
>> On 13.02.2017 08:10, Denis V. Lunev wrote:
>>> On 02/03/2017 06:08 PM, Denis V. Lunev wrote:
>>>> On 02/03/2017 06:06 PM, Denis V. Lunev wrote:
>>>>> From: Anton Nefedov <anton.nefedov@virtuozzo.com>
>>>>>
>>>>> 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 <anton.nefedov@virtuozzo.com>
>>>>> Signed-off-by: Denis V. Lunev <den@openvz.org>
>>>>> Reviewed-by: Eric Blake <eblake@redhat.com>
>>>>> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
>>>>> CC: Jeff Cody <jcody@redhat.com>
>>>>> CC: Kevin Wolf <kwolf@redhat.com>
>>>>> CC: Max Reitz <mreitz@redhat.com>
>>>> 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
>>
>
> Yes, I did.
thank you very much for clarification

Den

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-13 22:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-03 15:06 [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase Denis V. Lunev
2017-02-03 15:08 ` [Qemu-devel] [PATCH 1/1] mirror: do not increase offset during initial zero_or_discard phase - pls consider this as V3 patch Denis V. Lunev
2017-02-13  7:10   ` Denis V. Lunev
2017-02-13 17:16     ` Max Reitz
2017-02-13 19:13       ` Jeff Cody
2017-02-13 19:45         ` Denis V. Lunev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.