From: Alberto Garcia <berto@igalia.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
Max Reitz <mreitz@redhat.com>, Eric Blake <eblake@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
"Denis V . Lunev" <den@openvz.org>
Subject: Re: [Qemu-devel] [PATCH 0/7] qcow2: Reduce the number of I/O ops when doing COW
Date: Wed, 7 Jun 2017 13:44:06 +0200 [thread overview]
Message-ID: <20170607114406.GA24076@igalia.com> (raw)
In-Reply-To: <cover.1495536228.git.berto@igalia.com>
ping
On Tue, May 23, 2017 at 01:22:55PM +0200, Alberto Garcia wrote:
> Hi all,
>
> here's a patch series that rewrites the copy-on-write code in the
> qcow2 driver to reduce the number of I/O operations.
>
> The situation is that when a guest sends a write request and QEMU
> needs to allocate new cluster(s) in a qcow2 file, the unwritten
> regions of the new cluster(s) need to be filled with the existing data
> (e.g. from the backing image) or with zeroes.
>
> The whole process can require up to 5 I/O operations:
>
> 1) Write the data from the actual write request.
> 2) Read the existing data located before the guest data.
> 3) Write that data to the new clusters.
> 4) Read the existing data located after the guest data.
> 5) Write that data to the new clusters.
>
> This series reduces that to only two operations:
>
> 1) Read the existing data from the original clusters
> 2) Write the updated data (=original + guest request) to the new clusters
>
> Step (1) implies that there's data that will be read but will be
> immediately discarded (because it's overwritten by the guest
> request). I haven't really detected any big performance problems
> because of that, but I decided to be conservative and my code includes
> a simple heuristic that keeps the old behavior if the amount of data
> to be discarded is higher than 16KB.
>
> I've been testing this series in several scenarios, with different
> cluster sizes (32K, 64K, 1MB) and request sizes (from 4 up to 512KB),
> and both with an SSD and a rotating HDD. The results vary depending on
> the case, with an average increase of 60% in the number of IOPS in the
> HDD case, and 15% in the SSD case. In some cases there are really no
> big differences and the results are similar before and after this
> patch.
>
> Further work for the future includes detecting when the data that
> needs to be written consists on zeroes (i.e. allocating a new cluster
> with no backing image) and optimizing that case, but let's start with
> this.
>
> Regards,
>
> Berto
>
> Alberto Garcia (7):
> qcow2: Remove unused Error in do_perform_cow()
> qcow2: Use unsigned int for both members of Qcow2COWRegion
> qcow2: Make perform_cow() call do_perform_cow() twice
> qcow2: Split do_perform_cow() into _read(), _encrypt() and _write()
> qcow2: Allow reading both COW regions with only one request
> qcow2: Pass a QEMUIOVector to do_perform_cow_{read,write}()
> qcow2: Merge the writing of the COW regions with the guest data
>
> block/qcow2-cluster.c | 188 +++++++++++++++++++++++++++++++++++++-------------
> block/qcow2.c | 58 +++++++++++++---
> block/qcow2.h | 11 ++-
> 3 files changed, 197 insertions(+), 60 deletions(-)
>
> --
> 2.11.0
next prev parent reply other threads:[~2017-06-07 11:44 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-23 11:22 [Qemu-devel] [PATCH 0/7] qcow2: Reduce the number of I/O ops when doing COW Alberto Garcia
2017-05-23 11:22 ` [Qemu-devel] [PATCH 1/7] qcow2: Remove unused Error in do_perform_cow() Alberto Garcia
2017-05-23 20:21 ` Eric Blake
2017-05-24 9:48 ` Alberto Garcia
2017-05-23 11:22 ` [Qemu-devel] [PATCH 2/7] qcow2: Use unsigned int for both members of Qcow2COWRegion Alberto Garcia
2017-05-23 11:22 ` [Qemu-devel] [PATCH 3/7] qcow2: Make perform_cow() call do_perform_cow() twice Alberto Garcia
2017-05-26 8:11 ` Kevin Wolf
2017-05-26 9:10 ` Alberto Garcia
2017-05-26 10:08 ` Kevin Wolf
2017-05-23 11:22 ` [Qemu-devel] [PATCH 4/7] qcow2: Split do_perform_cow() into _read(), _encrypt() and _write() Alberto Garcia
2017-05-23 11:23 ` [Qemu-devel] [PATCH 5/7] qcow2: Allow reading both COW regions with only one request Alberto Garcia
2017-05-23 11:23 ` [Qemu-devel] [PATCH 6/7] qcow2: Pass a QEMUIOVector to do_perform_cow_{read, write}() Alberto Garcia
2017-05-23 11:23 ` [Qemu-devel] [PATCH 7/7] qcow2: Merge the writing of the COW regions with the guest data Alberto Garcia
[not found] ` <5925B107.1060404@virtuozzo.com>
2017-05-24 16:43 ` Anton Nefedov
2017-05-24 19:05 ` Alberto Garcia
2017-05-26 10:12 ` Kevin Wolf
2017-05-26 14:09 ` Alberto Garcia
2017-05-23 14:36 ` [Qemu-devel] [PATCH 0/7] qcow2: Reduce the number of I/O ops when doing COW Eric Blake
2017-05-24 14:20 ` Alberto Garcia
2017-05-24 16:09 ` Anton Nefedov
2017-05-24 16:20 ` Alberto Garcia
2017-05-24 16:26 ` Anton Nefedov
2017-05-25 11:48 ` Alberto Garcia
2017-05-25 14:35 ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2017-05-26 10:17 ` [Qemu-devel] " Kevin Wolf
2017-05-26 12:47 ` Anton Nefedov
2017-05-26 13:08 ` Alberto Garcia
2017-05-26 13:32 ` Anton Nefedov
2017-05-26 13:38 ` Alberto Garcia
2017-06-07 11:44 ` Alberto Garcia [this message]
2017-06-07 11:59 ` Kevin Wolf
2017-06-07 12:13 ` Alberto Garcia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170607114406.GA24076@igalia.com \
--to=berto@igalia.com \
--cc=den@openvz.org \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.