From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: berto@igalia.com, qemu-devel@nongnu.org, qemu-block@nongnu.org,
mreitz@redhat.com
Subject: Re: [PATCH v6 04/10] qcow2: Support BDRV_REQ_ZERO_WRITE for truncate
Date: Fri, 24 Apr 2020 09:16:40 -0500 [thread overview]
Message-ID: <48c05a8e-bc60-d0b9-2b0a-dd219cc4466b@redhat.com> (raw)
In-Reply-To: <20200424121712.GA4921@linux.fritz.box>
On 4/24/20 7:17 AM, Kevin Wolf wrote:
>
>>> + ret = qcow2_co_pwritev_part(bs, old_length, qiov.size, &qiov, 0, 0);
>>
>> Better not do it if this cluster is already ZERO.. But it may be a
>> later patch to improve that.
>
> I doubt it's worth writing code to optimise a corner case inside a
> corner case.
I spotted the same issue, and my suggestion was to use
qcow2_co_pwrite_zero instead of qcow2_co_pwritev_part, but Kevin pointed
out that my idea would probably not work the way I thought. Then again,
checking if the page is already zero is all the more benefit that
qcow2_co_pwrite_zero would have given for me to have raised the
question. The following example illustrates why it might be worthwhile:
Suppose we have an image with 1M clusters, which is an unaligned 100.5M
in length but started life with all clusters sparse. We then resize it
to another unaligned 200.5M. The call to qcow2_co_pwritev_part will
cause the image to be non-sparse for one cluster out of 201, whereas
adding a check to skip the pwritev because the original unaligned tail
cluster already read as zero will let us keep all clusters sparse.
At any rate, I argued that any such optimization would be a followup
patch, and Kevin is right that it is a corner case optimization unlikely
to affect many real-life images.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2020-04-24 14:18 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-23 15:01 [PATCH v6 00/10] block: Fix resize (extending) of short overlays Kevin Wolf
2020-04-23 15:01 ` [PATCH v6 01/10] block: Add flags to BlockDriver.bdrv_co_truncate() Kevin Wolf
2020-04-23 15:01 ` [PATCH v6 02/10] block: Add flags to bdrv(_co)_truncate() Kevin Wolf
2020-04-23 15:01 ` [PATCH v6 03/10] block-backend: Add flags to blk_truncate() Kevin Wolf
2020-04-23 15:01 ` [PATCH v6 04/10] qcow2: Support BDRV_REQ_ZERO_WRITE for truncate Kevin Wolf
2020-04-23 15:18 ` Eric Blake
2020-04-23 15:48 ` Kevin Wolf
2020-04-24 6:16 ` Vladimir Sementsov-Ogievskiy
2020-04-24 12:17 ` Kevin Wolf
2020-04-24 14:16 ` Eric Blake [this message]
2020-04-24 14:27 ` Vladimir Sementsov-Ogievskiy
2020-04-23 15:01 ` [PATCH v6 05/10] raw-format: " Kevin Wolf
2020-04-24 6:21 ` Vladimir Sementsov-Ogievskiy
2020-04-23 15:01 ` [PATCH v6 06/10] file-posix: " Kevin Wolf
2020-04-23 15:01 ` [PATCH v6 07/10] block: truncate: Don't make backing file data visible Kevin Wolf
2020-04-23 15:21 ` Eric Blake
2020-04-23 17:59 ` Max Reitz
2020-04-24 6:45 ` Vladimir Sementsov-Ogievskiy
2020-04-23 15:01 ` [PATCH v6 08/10] iotests: Filter testfiles out in filter_img_info() Kevin Wolf
2020-04-24 6:51 ` Vladimir Sementsov-Ogievskiy
2020-04-23 15:01 ` [PATCH v6 09/10] iotests: Test committing to short backing file Kevin Wolf
2020-04-24 8:53 ` Vladimir Sementsov-Ogievskiy
2020-04-23 15:01 ` [PATCH v6 10/10] qcow2: Forward ZERO_WRITE flag for full preallocation Kevin Wolf
2020-04-23 15:36 ` Eric Blake
2020-04-23 16:04 ` Kevin Wolf
2020-04-23 16:15 ` Eric Blake
2020-04-23 18:05 ` Max Reitz
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=48c05a8e-bc60-d0b9-2b0a-dd219cc4466b@redhat.com \
--to=eblake@redhat.com \
--cc=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/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).