From: Kevin Wolf <kwolf@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, famz@redhat.com,
jsnow@redhat.com, Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v6 07/24] block: Convert bdrv_get_block_status() to bytes
Date: Fri, 20 Oct 2017 16:31:24 +0200 [thread overview]
Message-ID: <20171020143124.GB3667@localhost.localdomain> (raw)
In-Reply-To: <20171012034720.11947-8-eblake@redhat.com>
Am 12.10.2017 um 05:47 hat Eric Blake geschrieben:
> We are gradually moving away from sector-based interfaces, towards
> byte-based. In the common case, allocation is unlikely to ever use
> values that are not naturally sector-aligned, but it is possible
> that byte-based values will let us be more precise about allocation
> at the end of an unaligned file that can do byte-based access.
>
> Changing the name of the function from bdrv_get_block_status() to
> bdrv_block_status() ensures that the compiler enforces that all
> callers are updated. For now, the io.c layer still assert()s that
> all callers are sector-aligned, but that can be relaxed when a later
> patch implements byte-based block status in the drivers.
>
> There was an inherent limitation in returning the offset via the
> return value: we only have room for BDRV_BLOCK_OFFSET_MASK bits, which
> means an offset can only be mapped for sector-aligned queries (or,
> if we declare that non-aligned input is at the same relative position
> modulo 512 of the answer), so the new interface also changes things to
> return the offset via output through a parameter by reference rather
> than mashed into the return value. We'll have some glue code that
> munges between the two styles until we finish converting all uses.
>
> For the most part this patch is just the addition of scaling at the
> callers followed by inverse scaling at bdrv_block_status(), coupled
> with the tweak in calling convention. But some code, particularly
> bdrv_is_allocated(), gets a lot simpler because it no longer has to
> mess with sectors.
>
> For ease of review, bdrv_get_block_status_above() will be tackled
> separately.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
>
> ---
> v6: redo interface to return byte-based offset by reference [Kevin]
> v5: drop pointless 'if (pnum)' [John], add comment
> v4: no change
> v3: clamp bytes to 32-bits, rather than asserting
> v2: rebase to earlier changes
> ---
> include/block/block.h | 17 +++++++++--------
> block/io.c | 47 ++++++++++++++++++++++++++++++++++-------------
> block/qcow2-cluster.c | 2 +-
> qemu-img.c | 25 ++++++++++++++-----------
> 4 files changed, 58 insertions(+), 33 deletions(-)
>
> diff --git a/include/block/block.h b/include/block/block.h
> index 440f3e9e39..7ac851f82f 100644
> --- a/include/block/block.h
> +++ b/include/block/block.h
> @@ -121,7 +121,7 @@ typedef struct HDGeometry {
> #define BDRV_REQUEST_MAX_BYTES (BDRV_REQUEST_MAX_SECTORS << BDRV_SECTOR_BITS)
>
> /*
> - * Allocation status flags for bdrv_get_block_status() and friends.
> + * Allocation status flags for bdrv_block_status() and friends.
> *
> * Public flags:
> * BDRV_BLOCK_DATA: allocation for data at offset is tied to this layer
> @@ -136,10 +136,11 @@ typedef struct HDGeometry {
> * that the block layer recompute the answer from the returned
> * BDS; must be accompanied by just BDRV_BLOCK_OFFSET_VALID.
> *
> - * If BDRV_BLOCK_OFFSET_VALID is set, bits 9-62 (BDRV_BLOCK_OFFSET_MASK)
> - * represent the offset in the returned BDS that is allocated for the
> - * corresponding raw data; however, whether that offset actually contains
> - * data also depends on BDRV_BLOCK_DATA and BDRV_BLOCK_ZERO, as follows:
> + * If BDRV_BLOCK_OFFSET_VALID is set, bits 9-62 (BDRV_BLOCK_OFFSET_MASK) of
> + * the return value (old interface) or the entire map parameter (new
> + * interface) represent the offset in the returned BDS that is allocated for
> + * the corresponding raw data.
Are there any functions using the old interface left at the end of the
series or do we want a final patch that removes the old interface from
the description?
Kevin
next prev parent reply other threads:[~2017-10-20 14:31 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-12 3:46 [Qemu-devel] [PATCH v6 00/24] make bdrv_get_block_status byte-based Eric Blake
2017-10-12 3:46 ` [Qemu-devel] [PATCH v6 01/24] block: Allow NULL file for bdrv_get_block_status() Eric Blake
2017-10-12 3:46 ` [Qemu-devel] [PATCH v6 02/24] block: Add flag to avoid wasted work in bdrv_is_allocated() Eric Blake
2017-10-12 3:46 ` [Qemu-devel] [PATCH v6 03/24] block: Make bdrv_round_to_clusters() signature more useful Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 04/24] qcow2: Switch is_zero_sectors() to byte-based Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 05/24] block: Switch bdrv_make_zero() " Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 06/24] qemu-img: Switch get_block_status() " Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 07/24] block: Convert bdrv_get_block_status() to bytes Eric Blake
2017-10-20 14:31 ` Kevin Wolf [this message]
2017-10-20 15:12 ` Eric Blake
2017-10-20 15:31 ` Kevin Wolf
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 08/24] block: Switch bdrv_co_get_block_status() to byte-based Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 09/24] block: Switch BdrvCoGetBlockStatusData " Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 10/24] block: Switch bdrv_common_block_status_above() " Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 11/24] block: Switch bdrv_co_get_block_status_above() " Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 12/24] block: Convert bdrv_get_block_status_above() to bytes Eric Blake
2017-10-20 15:03 ` Kevin Wolf
2017-10-20 15:22 ` Eric Blake
2017-10-20 15:34 ` Kevin Wolf
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 13/24] qemu-img: Simplify logic in img_compare() Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 14/24] qemu-img: Speed up compare on pre-allocated larger file Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 15/24] qemu-img: Add find_nonzero() Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 16/24] qemu-img: Drop redundant error message in compare Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 17/24] qemu-img: Change check_empty_sectors() to byte-based Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 18/24] qemu-img: Change compare_sectors() to be byte-based Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 19/24] qemu-img: Change img_rebase() " Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 20/24] qemu-img: Change img_compare() " Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 21/24] block: Align block status requests Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 22/24] block: Relax bdrv_aligned_preadv() assertion Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 23/24] qcow2: Relax is_zero() assertion Eric Blake
2017-10-12 13:20 ` Eric Blake
2017-10-20 15:11 ` Kevin Wolf
2017-10-20 15:32 ` Eric Blake
2017-10-12 3:47 ` [Qemu-devel] [PATCH v6 24/24] qemu-io: Relax 'alloc' now that block-status doesn't assert Eric Blake
2017-10-20 16:45 ` [Qemu-devel] [PATCH v6 00/24] make bdrv_get_block_status byte-based Kevin Wolf
2017-11-02 21:01 ` John Snow
2017-11-02 22:14 ` 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=20171020143124.GB3667@localhost.localdomain \
--to=kwolf@redhat.com \
--cc=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=jsnow@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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 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.