qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] qcow2: Return useful error code in refcount


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 2/2] qcow2: Return useful error code in refcount_init()
Date: Wed, 28 May 2014 16:33:06 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 05/28/2014 04:19 PM, Max Reitz wrote:
> If bdrv_pread() returns an error, it is very unlikely that it was
> ENOMEM. In this case, the return value should be passed along; as
> bdrv_pread() will always either return the number of bytes read or a
> negative value (the error code), the condition for checking whether
> bdrv_pread() failed can be simplified (and clarified) as well.
> 
> Signed-off-by: Max Reitz <address@hidden>
> ---
>  block/qcow2-refcount.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
>          ret = bdrv_pread(bs->file, s->refcount_table_offset,
>                           s->refcount_table, refcount_table_size2);
> -        if (ret != refcount_table_size2)

Can bdrv_pread() ever do a short read?  If it can, then in the old code,
that was an error,

> +        if (ret < 0) {
>              goto fail;

but in the new code it falls through to the remaining code; and I'm not
sure whether that changes semantics.

(My quick read of bdrv_pread() didn't find an obvious answer, but it DID
raise another question: why do we have '.iov_base = (void *)buf' when
buf is already void*?)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]