qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sunny Zhu <sunnyzhyy@qq.com>
To: eblake@redhat.com
Cc: hreitz@redhat.com, jsnow@redhat.com, kwolf@redhat.com,
	qemu-block@nongnu.org, qemu-devel@nongnu.org,
	stefanha@redhat.com, vsementsov@yandex-team.ru
Subject: Re [PATCH v3 08/11] mirror: Skip writing zeroes when target is already zero
Date: Thu,  1 May 2025 00:38:30 +0800	[thread overview]
Message-ID: <tencent_896794CDF9345EF41DF2DCA4B08380B22D07@qq.com> (raw)
In-Reply-To: <20250425005439.2252467-21-eblake@redhat.com>

on Thu 24 Apr 2025 19:52:08 -0500, Eric wrote:
>      if (s->zero_target) {
> +        int64_t bitmap_length = DIV_ROUND_UP(s->bdev_length, s->granularity);
> +
>          offset = 0;
>          bdrv_graph_co_rdlock();
>          ret = bdrv_co_is_all_zeroes(target_bs);
> @@ -856,6 +898,7 @@ static int coroutine_fn GRAPH_UNLOCKED mirror_dirty_init(MirrorBlockJob *s)
>          if (ret < 0) {
>              return ret;
>          }
> +        s->zero_bitmap = bitmap_new(bitmap_length);
>          /*
>           * If the destination already reads as zero, and we are not
>           * requested to punch holes into existing zeroes, then we can
> @@ -864,6 +907,7 @@ static int coroutine_fn GRAPH_UNLOCKED mirror_dirty_init(MirrorBlockJob *s)
>          if (ret > 0 &&
>              (target_bs->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP ||
>               !bdrv_can_write_zeroes_with_unmap(target_bs))) {
> +            bitmap_set(s->zero_bitmap, 0, bitmap_length);

when arg->mode != NEW_IMAGE_MODE_EXISTING && bdrv_has_zero_init(target_bs) is true
in drive_mirror (This means the target image is newly created), in which case
s->zero_target == false, we still need to execute bitmap_set(s->zero_bitmap, 0, bitmap_length) 

>              offset = s->bdev_length;
>          }
>          if (!bdrv_can_write_zeroes_with_unmap(target_bs)) {
> @@ -875,6 +919,7 @@ static int coroutine_fn GRAPH_UNLOCKED mirror_dirty_init(MirrorBlockJob *s)
>          while (offset < s->bdev_length) {
>              int bytes = MIN(s->bdev_length - offset,
>                              QEMU_ALIGN_DOWN(INT_MAX, s->granularity));



  reply	other threads:[~2025-04-30 16:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25  0:52 [PATCH v3 00/11] Make blockdev-mirror dest sparse in more cases Eric Blake
2025-04-25  0:52 ` [PATCH v3 01/11] block: Expand block status mode from bool to flags Eric Blake
2025-04-25  0:52 ` [PATCH v3 02/11] file-posix, gluster: Handle zero block status hint better Eric Blake
2025-04-25  0:52 ` [PATCH v3 03/11] block: Let bdrv_co_is_zero_fast consolidate adjacent extents Eric Blake
2025-05-01 17:20   ` Stefan Hajnoczi
2025-04-25  0:52 ` [PATCH v3 04/11] block: Add new bdrv_co_is_all_zeroes() function Eric Blake
2025-05-01 17:24   ` Stefan Hajnoczi
2025-04-25  0:52 ` [PATCH v3 05/11] iotests: Improve iotest 194 to mirror data Eric Blake
2025-04-25  0:52 ` [PATCH v3 06/11] mirror: Minor refactoring Eric Blake
2025-04-25  0:52 ` [PATCH v3 07/11] mirror: Skip pre-zeroing destination if it is already zero Eric Blake
2025-04-30 16:09   ` Sunny Zhu
2025-05-01 17:33     ` Eric Blake
2025-05-02  3:26       ` Sunny Zhu
2025-04-25  0:52 ` [PATCH v3 08/11] mirror: Skip writing zeroes when target " Eric Blake
2025-04-30 16:38   ` Sunny Zhu [this message]
2025-05-01 17:58     ` Re " Eric Blake
2025-05-02  5:43       ` Sunny Zhu
2025-04-25  0:52 ` [PATCH v3 09/11] iotests/common.rc: add disk_usage function Eric Blake
2025-04-25  0:52 ` [PATCH v3 10/11] tests: Add iotest mirror-sparse for recent patches Eric Blake
2025-05-01 17:34   ` Stefan Hajnoczi
2025-05-01 18:00     ` Eric Blake
2025-05-09 15:33   ` Eric Blake
2025-08-01  7:54   ` Michael Tokarev
2025-04-25  0:52 ` [PATCH v3 11/11] mirror: Allow QMP override to declare target already zero Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_896794CDF9345EF41DF2DCA4B08380B22D07@qq.com \
    --to=sunnyzhyy@qq.com \
    --cc=eblake@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@yandex-team.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).