[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 7/7] qcow2: Merge the writing of the COW regions
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-block] [PATCH 7/7] qcow2: Merge the writing of the COW regions with the guest data |
Date: |
Fri, 26 May 2017 16:09:45 +0200 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
On Tue 23 May 2017 01:23:02 PM CEST, Alberto Garcia wrote:
You can still review this now if you want, but here's a couple of minor
things I'll correct in the next revision:
> + if (m->data_qiov) {
> + qemu_iovec_reset(&qiov);
> + qemu_iovec_add(&qiov, start_buffer, start->nb_bytes);
> + qemu_iovec_concat(&qiov, m->data_qiov, 0, data_bytes);
> + qemu_iovec_add(&qiov, end_buffer, end->nb_bytes);
I'll check start->nb_bytes and end->nb_bytes for zero before calling
qemu_iovec_add() (no practical difference, but I find it a bit cleaner).
> +/* Check if it's possible to merge a write request with the writing of
> + * the data from the COW regions */
> +static bool can_merge_cow(uint64_t offset, unsigned bytes,
> + QEMUIOVector *hd_qiov, QCowL2Meta *l2meta)
> +{
> + QCowL2Meta *m;
> +
> + for (m = l2meta; m != NULL; m = m->next) {
> + /* If both COW regions are empty then there's nothing to merge */
> + if (m->cow_start.nb_bytes == 0 && m->cow_end.nb_bytes == 0) {
> + continue;
> + }
> +
> + /* The data (middle) region must be immediately after the
> + * start region */
> + if (l2meta_cow_start(m) + m->cow_start.nb_bytes != offset) {
> + continue;
> + }
I realized that I'm using guest offsets in this function. Since this
checks if we can _write_ everything together I think I should be using
host offsets instead.
I also don't think this makes any difference in practice in this case,
but I'll update it.
Berto
- [Qemu-block] [PATCH 1/7] qcow2: Remove unused Error in do_perform_cow(), (continued)
- [Qemu-block] [PATCH 1/7] qcow2: Remove unused Error in do_perform_cow(), Alberto Garcia, 2017/05/23
- [Qemu-block] [PATCH 5/7] qcow2: Allow reading both COW regions with only one request, Alberto Garcia, 2017/05/23
- [Qemu-block] [PATCH 6/7] qcow2: Pass a QEMUIOVector to do_perform_cow_{read, write}(), Alberto Garcia, 2017/05/23
- [Qemu-block] [PATCH 2/7] qcow2: Use unsigned int for both members of Qcow2COWRegion, Alberto Garcia, 2017/05/23
- [Qemu-block] [PATCH 7/7] qcow2: Merge the writing of the COW regions with the guest data, Alberto Garcia, 2017/05/23
- Re: [Qemu-block] [PATCH 7/7] qcow2: Merge the writing of the COW regions with the guest data,
Alberto Garcia <=
[Qemu-block] [PATCH 3/7] qcow2: Make perform_cow() call do_perform_cow() twice, Alberto Garcia, 2017/05/23
[Qemu-block] [PATCH 4/7] qcow2: Split do_perform_cow() into _read(), _encrypt() and _write(), Alberto Garcia, 2017/05/23
Re: [Qemu-block] [PATCH 0/7] qcow2: Reduce the number of I/O ops when doing COW, Eric Blake, 2017/05/23