[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] qemu-img: make sure contain the consecutive
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] qemu-img: make sure contain the consecutive number of zero bytes |
Date: |
Mon, 24 Apr 2017 09:43:18 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 |
On 04/23/2017 09:33 AM, address@hidden wrote:
> From: Lidong Chen <address@hidden>
>
> is_allocated_sectors_min don't guarantee to contain the
> consecutive number of zero bytes. this patch fixes this bug.
This message was sent without an 'In-Reply-To' header pointing to a 0/2
cover letter. When sending a series, please always thread things to a
cover letter; you may find 'git config format.coverletter auto' to be
helpful.
>
> Signed-off-by: Lidong Chen <address@hidden>
> ---
> qemu-img.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/qemu-img.c b/qemu-img.c
> index b220cf7..df6d165 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -1060,9 +1060,9 @@ static int is_allocated_sectors(const uint8_t *buf, int
> n, int *pnum)
> }
>
> /*
> - * Like is_allocated_sectors, but if the buffer starts with a used sector,
> - * up to 'min' consecutive sectors containing zeros are ignored. This avoids
> - * breaking up write requests for only small sparse areas.
> + * Like is_allocated_sectors, but up to 'min' consecutive sectors
> + * containing zeros are ignored. This avoids breaking up write requests
> + * for only small sparse areas.
> */
> static int is_allocated_sectors_min(const uint8_t *buf, int n, int *pnum,
> int min)
> @@ -1071,11 +1071,12 @@ static int is_allocated_sectors_min(const uint8_t
> *buf, int n, int *pnum,
> int num_checked, num_used;
>
> if (n < min) {
> - min = n;
> + *pnum = n;
> + return 1;
> }
>
> ret = is_allocated_sectors(buf, n, pnum);
> - if (!ret) {
> + if (!ret && *pnum >= min) {
I seem to recall past attempts to try and patch this function, which
were then turned down, although I haven't scrubbed the archives for a
quick URL to point to. I'm worried that there are more subtleties here
than what you realize.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 1/2] qemu-img: make sure contain the consecutive number of zero bytes, jemmy858585, 2017/04/23
- [Qemu-devel] [PATCH 2/2] qemu-img: fix some spelling errors, jemmy858585, 2017/04/23
- Re: [Qemu-devel] [PATCH 2/2] qemu-img: fix some spelling errors, Eric Blake, 2017/04/24
- Re: [Qemu-devel] [PATCH 2/2] qemu-img: fix some spelling errors, Philippe Mathieu-Daudé, 2017/04/24
- Re: [Qemu-devel] [PATCH 2/2] qemu-img: fix some spelling errors, Eric Blake, 2017/04/24
- Re: [Qemu-devel] [PATCH 2/2] qemu-img: fix some spelling errors, Eric Blake, 2017/04/24
- Re: [Qemu-devel] [PATCH 2/2] qemu-img: fix some spelling errors, 858585 jemmy, 2017/04/24
- Re: [Qemu-devel] [PATCH 2/2] qemu-img: fix some spelling errors, Max Reitz, 2017/04/25
- Re: [Qemu-devel] [PATCH 2/2] qemu-img: fix some spelling errors, 858585 jemmy, 2017/04/26
Re: [Qemu-devel] [PATCH 1/2] qemu-img: make sure contain the consecutive number of zero bytes,
Eric Blake <=