qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com,
	Anton.Nefedov@acronis.com, armbru@redhat.com,
	qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com,
	den@openvz.org
Subject: [PATCH 0/5] preallocate filter
Date: Sat, 20 Jun 2020 17:36:44 +0300	[thread overview]
Message-ID: <20200620143649.225852-1-vsementsov@virtuozzo.com> (raw)

Hi all!

Here is a filter, which does preallocation on write.

In Virtuozzo we have to deal with some custom distributed storage solution,
where allocation is relatively expensive operation. We have to workaround it
in Qemu, so here is a new filter.

Performance results with the following test are very significant:

    IMG=/megassd/z; FILE_OPTS=file.filename=$IMG; COUNT=15000; CHUNK=64K; \
    CLUSTER=1M; rm -f $IMG; \
    ./qemu-img create -f qcow2 -o cluster_size=$CLUSTER $IMG 1G; \
    ./qemu-img bench -c $COUNT -d 1 -s $CHUNK -w -t none --image-opts driver=qcow2,$FILE_OPTS;

 - qemu-img bench reports ~44.3s, and if I switch FILE_OPTS to be

    FILE_OPTS=file.driver=preallocate,file.file.filename=$IMG

 qemu-img bench reports ~4.3s, 90% benefit!

(/megassd is a mount point of distributed storage)

Unfortunately, I don't know another real-world case where preallocation
would so helpful. If someone have running ceph instance and can check
it I'd be very grateful.

Still, I hope, it may be useful at least for some testing purposes.
And, small example I have: small writes with small sectors on usual ext4 over ssd gives
the following for me:

    IMG=/ssd/z; FILE_OPTS=file.filename=$IMG; COUNT=15000; CHUNK=512; \
    CLUSTER=512; rm -f $IMG; \
    ./qemu-img create -f qcow2 -o cluster_size=$CLUSTER $IMG 1G; \
    ./qemu-img bench -c $COUNT -d 1 -s $CHUNK -w -t none --image-opts driver=qcow2,$FILE_OPTS;

 ~17.1s

 and, if I switch FILE_OPTS to use new filter, the result is ~14.9s, i.e ~13% better.

=====

The series also introduces bdrv-lock-region interface, which may be reused to
implement copy-on-read operation directly inside copy-on-read filter, instead of
handling the special flag in generic code.

Vladimir Sementsov-Ogievskiy (5):
  block/io: introduce bdrv_try_mark_request_serialising
  block/io: introduce bdrv_co_range_try_lock
  block: introduce preallocate filter
  iotests: QemuIoInteractive: use qemu_io_args_no_fmt
  iotests: add 298 to test new preallocate filter driver

 qapi/block-core.json          |   3 +-
 include/block/block.h         |   9 ++
 include/block/block_int.h     |  16 +++
 include/qemu/typedefs.h       |   1 +
 block/io.c                    | 142 ++++++++++++++++---
 block/preallocate.c           | 255 ++++++++++++++++++++++++++++++++++
 block/Makefile.objs           |   1 +
 tests/qemu-iotests/298        |  45 ++++++
 tests/qemu-iotests/298.out    |   5 +
 tests/qemu-iotests/group      |   1 +
 tests/qemu-iotests/iotests.py |   2 +-
 11 files changed, 455 insertions(+), 25 deletions(-)
 create mode 100644 block/preallocate.c
 create mode 100644 tests/qemu-iotests/298
 create mode 100644 tests/qemu-iotests/298.out

-- 
2.18.0



             reply	other threads:[~2020-06-20 14:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-20 14:36 Vladimir Sementsov-Ogievskiy [this message]
2020-06-20 14:36 ` [PATCH 1/5] block/io: introduce bdrv_try_mark_request_serialising Vladimir Sementsov-Ogievskiy
2020-07-07 15:56   ` Stefan Hajnoczi
2020-07-08 15:51     ` Vladimir Sementsov-Ogievskiy
2020-07-13 11:23       ` Stefan Hajnoczi
2020-06-20 14:36 ` [PATCH 2/5] block/io: introduce bdrv_co_range_try_lock Vladimir Sementsov-Ogievskiy
2020-07-07 16:10   ` Stefan Hajnoczi
2020-07-08 15:56     ` Vladimir Sementsov-Ogievskiy
2020-07-13 11:23       ` Stefan Hajnoczi
2020-06-20 14:36 ` [PATCH 3/5] block: introduce preallocate filter Vladimir Sementsov-Ogievskiy
2020-07-08 12:07   ` Stefan Hajnoczi
2020-07-08 16:17     ` Vladimir Sementsov-Ogievskiy
2020-07-13 11:27       ` Stefan Hajnoczi
2020-06-20 14:36 ` [PATCH 4/5] iotests: QemuIoInteractive: use qemu_io_args_no_fmt Vladimir Sementsov-Ogievskiy
2020-07-08 12:08   ` Stefan Hajnoczi
2020-06-20 14:36 ` [PATCH 5/5] iotests: add 298 to test new preallocate filter driver Vladimir Sementsov-Ogievskiy
2020-07-08 12:09   ` Stefan Hajnoczi

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=20200620143649.225852-1-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=Anton.Nefedov@acronis.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=fam@euphon.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).