[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v2 3/7] qcow2: Make perform_cow() call do_perfor
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [PATCH v2 3/7] qcow2: Make perform_cow() call do_perform_cow() twice |
Date: |
Wed, 7 Jun 2017 16:43:34 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 |
On 06/07/2017 09:08 AM, Alberto Garcia wrote:
> Instead of calling perform_cow() twice with a different COW region
> each time, call it just once and make perform_cow() handle both
> regions.
>
> This patch simply moves code around. The next one will do the actual
> reordering of the COW operations.
>
> Signed-off-by: Alberto Garcia <address@hidden>
> ---
> block/qcow2-cluster.c | 38 +++++++++++++++++++++++---------------
> 1 file changed, 23 insertions(+), 15 deletions(-)
> qemu_co_mutex_unlock(&s->lock);
> - ret = do_perform_cow(bs, m->offset, m->alloc_offset, r->offset,
> r->nb_bytes);
> + ret = do_perform_cow(bs, m->offset, m->alloc_offset,
> + start->offset, start->nb_bytes);
> + if (ret < 0) {
> + goto fail;
> + }
> +
> + ret = do_perform_cow(bs, m->offset, m->alloc_offset,
> + end->offset, end->nb_bytes);
> +
> +fail:
Since you reach this label even on success, it feels a bit awkward. I
probably would have avoided the goto and used fewer lines by refactoring
the logic as:
ret = do_perform_cow(..., start->...);
if (ret >= 0) {
ret = do_perform_cow(..., end->...);
}
But that doesn't affect correctness, so whether or not you redo the
logic in the shorter fashion:
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH v2 1/7] qcow2: Remove unused Error variable in do_perform_cow(), (continued)
- [Qemu-block] [PATCH v2 3/7] qcow2: Make perform_cow() call do_perform_cow() twice, Alberto Garcia, 2017/06/07
- Re: [Qemu-block] [PATCH v2 3/7] qcow2: Make perform_cow() call do_perform_cow() twice,
Eric Blake <=
- [Qemu-block] [PATCH v2 6/7] qcow2: Pass a QEMUIOVector to do_perform_cow_{read, write}(), Alberto Garcia, 2017/06/07
- [Qemu-block] [PATCH v2 5/7] qcow2: Allow reading both COW regions with only one request, Alberto Garcia, 2017/06/07
- [Qemu-block] [PATCH v2 4/7] qcow2: Split do_perform_cow() into _read(), _encrypt() and _write(), Alberto Garcia, 2017/06/07
- Re: [Qemu-block] [PATCH v2 0/7] qcow2: Reduce the number of I/O ops when doing COW, Kevin Wolf, 2017/06/16