From: Eric Blake <eblake@redhat.com>
To: Jeff Cody <jcody@redhat.com>
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, qemu-block@nongnu.org,
mreitz@redhat.com
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2 5/8] qcow: Switch to a byte-based driver
Date: Tue, 5 Jun 2018 06:12:33 -0500 [thread overview]
Message-ID: <49cdd9e3-11ba-1b82-5a5d-1813359bfdf7@redhat.com> (raw)
In-Reply-To: <20180604213327.GF14298@localhost.localdomain>
On 06/04/2018 04:33 PM, Jeff Cody wrote:
> On Thu, May 31, 2018 at 03:50:43PM -0500, Eric Blake wrote:
>> We are gradually moving away from sector-based interfaces, towards
>> byte-based. The qcow driver is now ready to fully utilize the
>> byte-based callback interface, as long as we override the default
>> alignment to still be 512 (needed at least for asserts present
>> because of encryption, but easier to do everywhere than to audit
>> which sub-sector requests are handled correctly, especially since
>> we no longer recommend qcow for new disk images).
>>
>> Signed-off-by: Eric Blake <eblake@redhat.com>
>> -static coroutine_fn int qcow_co_readv(BlockDriverState *bs, int64_t sector_num,
>> - int nb_sectors, QEMUIOVector *qiov)
>> +static void qcow_refresh_limits(BlockDriverState *bs, Error **errp)
>> +{
>> + /* At least encrypted images require 512-byte alignment. Apply the
>> + * limit universally, rather than just on encrypted images, as
>> + * it's easier to let the block layer handle rounding than to
>> + * audit this code further. */
>> + bs->bl.request_alignment = BDRV_SECTOR_SIZE;
>> +}
>> +
>> +static coroutine_fn int qcow_co_preadv(BlockDriverState *bs, uint64_t offset,
>> + uint64_t bytes, QEMUIOVector *qiov,
>> + int flags)
>> {
>> BDRVQcowState *s = bs->opaque;
>> int offset_in_cluster;
>> @@ -624,9 +632,8 @@ static coroutine_fn int qcow_co_readv(BlockDriverState *bs, int64_t sector_num,
>> QEMUIOVector hd_qiov;
>> uint8_t *buf;
>> void *orig_buf;
>> - int64_t offset = sector_num * BDRV_SECTOR_SIZE;
>> - int64_t bytes = nb_sectors * BDRV_SECTOR_SIZE;
>>
>> + assert(!flags);
>
> Why this assert here and in the _pwritev()?
We're changing from an interface that didn't have flags to one that
does, but we are not prepared to handle any flags, so the assert proves
the block layer doesn't hand us any flags we aren't expecting (there are
no block layer flags for pread at the moment; and no flags for pwrite
because we didn't set bs->supported_write_flags).
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2018-06-05 11:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-31 20:50 [Qemu-devel] [PATCH v2 0/8] block: more byte-based cleanups: vectored I/O Eric Blake
2018-05-31 20:50 ` [Qemu-devel] [PATCH v2 1/8] parallels: Switch to byte-based calls Eric Blake
2018-06-01 2:19 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-31 20:50 ` [Qemu-devel] [PATCH v2 2/8] qcow: Switch get_cluster_offset to be byte-based Eric Blake
2018-06-04 20:41 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-31 20:50 ` [Qemu-devel] [PATCH v2 3/8] qcow: Switch qcow_co_readv to byte-based calls Eric Blake
2018-06-04 21:17 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-31 20:50 ` [Qemu-devel] [PATCH v2 4/8] qcow: Switch qcow_co_writev " Eric Blake
2018-06-04 21:27 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-31 20:50 ` [Qemu-devel] [PATCH v2 5/8] qcow: Switch to a byte-based driver Eric Blake
2018-06-04 21:33 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-06-05 11:12 ` Eric Blake [this message]
2018-06-05 13:36 ` Jeff Cody
2018-05-31 20:50 ` [Qemu-devel] [PATCH v2 6/8] replication: Switch to byte-based calls Eric Blake
2018-06-01 3:55 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-31 20:50 ` [Qemu-devel] [PATCH v2 7/8] vhdx: " Eric Blake
2018-06-01 2:42 ` Jeff Cody
2018-05-31 20:50 ` [Qemu-devel] [PATCH v2 8/8] block: Remove unused sector-based vectored I/O Eric Blake
2018-06-01 3:55 ` [Qemu-devel] [Qemu-block] " Jeff Cody
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=49cdd9e3-11ba-1b82-5a5d-1813359bfdf7@redhat.com \
--to=eblake@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).