From: Eric Blake <eblake@redhat.com>
To: "Denis V. Lunev" <den@openvz.org>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
John Snow <jsnow@redhat.com>,
Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Subject: Re: [PATCH v4 12/12] block/block-copy: coalesce write-zeroes tasks
Date: Mon, 2 Nov 2026 21:37:12 -0600 [thread overview]
Message-ID: <aulWN3IIdjcqmq_M@redhat.com> (raw)
In-Reply-To: <20261030010613.1612771-13-den@openvz.org>
On Fri, Oct 30, 2026 at 02:06:12AM +0100, Denis V. Lunev wrote:
> From: Denis V. Lunev <den@openvz.org>
>
> Task size was capped to block_copy_chunk_size() regardless of method,
> which sizes a task by the copy buffer. A write-zeroes task carries no
> buffer, so that cap only splits one long known-zero run into a crowd of
> small COPY_WRITE_ZEROES tasks, each with its own request against the
> target.
>
> block_copy_task_create() already decides from zero_bitmap how far a task
> may run, so add block_copy_widen_zero_area() to that decision: a
> write-zeroes task runs to the next clean cluster of copy_bitmap, at most
> BDRV_REQUEST_MAX_BYTES aligned down to cluster_size, and the existing
> clamp cuts it back to where the zero run ends. The experimental x-perf
> max-chunk does not bound it, and its documentation now says so.
> Widening is safe: an overlapping caller waits on the task's BlockReq via
> reqlist_wait_one() rather than observing it mid-flight.
>
> A request that large is only cheap where the target zeroes by metadata.
> BDRV_REQ_NO_FALLBACK in supported_zero_flags rules out the targets which
> cannot, qcow2 v2 and iscsi among them, but it is optimistic for the
> rest: file-posix advertises it at open and only learns from a failing
> fallocate. So a write-zeroes task asks for it while the target is
> believed to oblige, which costs nothing when it does. A refusal ends the
> widening and shrinks the task to one cluster, written with fallback
> allowed. The rest of the range is dirty again, and the next pass of
> block_copy_common() picks it up as buffer-sized tasks running in
> parallel. Part of the refused range may already be zeroed, since
> -ENOTSUP only says the fast path is unavailable, and writing zeroes over
> it again changes nothing.
>
> Such a task is also the only one sure to need no buffer: without
> NO_FALLBACK, bdrv_co_do_pwrite_zeroes() writes the zeroes out through a
> bounce buffer. So it alone is left out of the memory pool and of the
> rate limit, where one widened request would otherwise hold the job back
> for as long as speed= takes to pass its whole length. The one-cluster
> write left after a refusal is not charged either, though it may bounce:
> that is at most one cluster per worker, once, as tasks created after the
> refusal are charged in full.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> CC: John Snow <jsnow@redhat.com>
> CC: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
> ---
> block/block-copy.c | 96 +++++++++++++++++++++++++++++++++++++++-----
> qapi/block-core.json | 4 +-
> 2 files changed, 88 insertions(+), 12 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
next prev parent reply other threads:[~2026-11-03 3:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 1:06 [PATCH v4 00/12] block: cheaper zero handling in backup and commit Denis V. Lunev
2026-10-30 1:06 ` [PATCH v4 01/12] block/commit: pass BDRV_WANT_PRECISE to block-status Denis V. Lunev
2026-10-30 1:06 ` [PATCH v4 02/12] iotests/040: cover large and fragmented commit runs Denis V. Lunev
2026-10-30 1:06 ` [PATCH v4 03/12] block/commit: batch block-status queries Denis V. Lunev
2026-10-30 1:06 ` [PATCH v4 04/12] iotests/124: cover backup of zero clusters and holes Denis V. Lunev
2026-10-30 1:06 ` [PATCH v4 05/12] block/block-copy: extract block_copy_set_task_method() Denis V. Lunev
2026-10-30 1:06 ` [PATCH v4 06/12] block/block-copy: track known-zero source clusters Denis V. Lunev
2026-10-30 1:06 ` [PATCH v4 07/12] block/backup: pre-fill zero_bitmap for full/bitmap Denis V. Lunev
2026-10-30 1:06 ` [PATCH v4 08/12] block/block-copy: rename block_copy_is_cluster_allocated() Denis V. Lunev
2026-10-30 1:06 ` [PATCH v4 09/12] block/block-copy: merge the two backup scan steps into block_copy_prescan() Denis V. Lunev
2026-11-03 3:26 ` Eric Blake
2026-10-30 1:06 ` [PATCH v4 10/12] block/block-copy: replace zero_bitmap_valid with scan_done Denis V. Lunev
2026-11-03 3:27 ` Eric Blake
2026-10-30 1:06 ` [PATCH v4 11/12] util/co-shared-resource: skip the mutex for an empty request Denis V. Lunev
2026-11-03 3:32 ` Eric Blake
2026-10-30 1:06 ` [PATCH v4 12/12] block/block-copy: coalesce write-zeroes tasks Denis V. Lunev
2026-11-03 3:37 ` Eric Blake [this message]
2026-11-02 16:26 ` [PATCH v4 00/12] block: cheaper zero handling in backup and commit 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=aulWN3IIdjcqmq_M@redhat.com \
--to=eblake@redhat.com \
--cc=andrey.drobyshev@virtuozzo.com \
--cc=den@openvz.org \
--cc=jsnow@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--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 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.