qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [Qemu-devel] [PATCH v3 10/17] block/qed: use qemu_iovec


From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v3 10/17] block/qed: use qemu_iovec_init_buf
Date: Thu, 7 Feb 2019 09:18:24 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

On 2/7/19 4:24 AM, Vladimir Sementsov-Ogievskiy wrote:
> Use new qemu_iovec_init_buf() instead of
> qemu_iovec_init_external( ... , 1), which simplifies the code.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
> ---
>  block/qed-table.c | 16 +++-------------
>  block/qed.c       | 31 +++++++++----------------------
>  2 files changed, 12 insertions(+), 35 deletions(-)
> 

> @@ -921,11 +915,7 @@ static int coroutine_fn 
> qed_copy_from_backing_file(BDRVQEDState *s,
>          return 0;
>      }
>  
> -    iov = (struct iovec) {
> -        .iov_base = qemu_blockalign(s->bs, len),
> -        .iov_len = len,
> -    };
> -    qemu_iovec_init_external(&qiov, &iov, 1);
> +    qemu_iovec_init_buf(&qiov, qemu_blockalign(s->bs, len), len);
>  
>      ret = qed_read_backing_file(s, pos, &qiov, &backing_qiov);
>  
> @@ -946,7 +936,7 @@ static int coroutine_fn 
> qed_copy_from_backing_file(BDRVQEDState *s,
>      }
>      ret = 0;
>  out:
> -    qemu_vfree(iov.iov_base);
> +    qemu_vfree(qemu_iovec_get_buf(&qiov));

Matching my comments on 7/17, a separate variable to hold the allocated
buffer may mean that you don't need qemu_iovec_get_buf().

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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