[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 4/8] qemu-img: add chunk size parameter to compare_buffers
From: |
Eric Blake |
Subject: |
Re: [PATCH v2 4/8] qemu-img: add chunk size parameter to compare_buffers() |
Date: |
Fri, 15 Sep 2023 14:28:36 -0500 |
User-agent: |
NeoMutt/20230517 |
On Fri, Sep 15, 2023 at 07:20:12PM +0300, Andrey Drobyshev wrote:
> Add @chsize param to the function which, if non-zero, would represent
> the chunk size to be used for comparison. If it's zero, then
> BDRV_SECTOR_SIZE is used as default chunk size, which is the previous
> behaviour.
>
> In particular, we're going to use this param in img_rebase() to make the
> write requests aligned to a predefined alignment value.
>
> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
> ---
> qemu-img.c | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/qemu-img.c b/qemu-img.c
> index d12e4a4753..fcd31d7b5b 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -1274,23 +1274,29 @@ static int is_allocated_sectors_min(const uint8_t
> *buf, int n, int *pnum,
> }
>
> /*
> - * Compares two buffers sector by sector. Returns 0 if the first
> - * sector of each buffer matches, non-zero otherwise.
> + * Compares two buffers chunk by chunk, where @chsize is the chunk size.
> + * If @chsize is 0, default chunk size of BDRV_SECTOR_SIZE is used.
> + * Returns 0 if the first chunk of each buffer matches, non-zero otherwise.
> *
> - * pnum is set to the sector-aligned size of the buffer prefix that
> + * @pnum is set to the size of the buffer prefix aligned to @chsize that
> * has the same matching status as the first sector.
s/sector/chunk/
With that,
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
- [PATCH v2 0/8] qemu-img: rebase: add compression support, Andrey Drobyshev, 2023/09/15
- [PATCH v2 7/8] qemu-img: add compression option to rebase subcommand, Andrey Drobyshev, 2023/09/15
- [PATCH v2 2/8] qemu-iotests: 024: add rebasing test case for overlay_size > backing_size, Andrey Drobyshev, 2023/09/15
- [PATCH v2 1/8] qemu-img: rebase: stop when reaching EOF of old backing file, Andrey Drobyshev, 2023/09/15
- [PATCH v2 8/8] iotests: add tests for "qemu-img rebase" with compression, Andrey Drobyshev, 2023/09/15
- [PATCH v2 4/8] qemu-img: add chunk size parameter to compare_buffers(), Andrey Drobyshev, 2023/09/15
- [PATCH v2 5/8] qemu-img: rebase: avoid unnecessary COW operations, Andrey Drobyshev, 2023/09/15
- [PATCH v2 6/8] iotests/{024, 271}: add testcases for qemu-img rebase, Andrey Drobyshev, 2023/09/15
- [PATCH v2 3/8] qemu-img: rebase: use backing files' BlockBackend for buffer alignment, Andrey Drobyshev, 2023/09/15