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 <mre...@redhat.com> > --- > 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
signature.asc
Description: OpenPGP digital signature