qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: "Richard W.M. Jones" <rjones@redhat.com>
Cc: Peter Lieven <pl@kamp.de>,
	libguestfs@redhat.com, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Effect of qemu-img convert -m and -W options
Date: Thu, 16 Nov 2017 17:20:30 +0000	[thread overview]
Message-ID: <CAJSP0QXepBMucAFNSbihp6awkurZ=47fTwgv7UHQ3MRiATGS5w@mail.gmail.com> (raw)
In-Reply-To: <20171116151233.GW2787@redhat.com>

On Thu, Nov 16, 2017 at 3:12 PM, Richard W.M. Jones <rjones@redhat.com> wrote:
> On Thu, Nov 16, 2017 at 03:51:29PM +0100, Peter Lieven wrote:
>> Afaik all writes to the same QCOW2 serialize because of the s->lock that
>> is held during the write. So its not suprising that there is no benefit from
>> mutliple threads as long as reading from the RAW file involves no delay.
>> Which is likely due to readahead of the OS.
>
> I guess this would explain it, thanks.

The theory is false for preallocated qcow2 image files.  Parallel
writes do occur in block/qcow2.c:qcow2_co_pwritev() if the cluster is
already allocated:

            qemu_co_mutex_unlock(&s->lock);  <----- parallel!
            BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO);
            trace_qcow2_writev_data(qemu_coroutine_self(),
                                    cluster_offset + offset_in_cluster);
            ret = bdrv_co_pwritev(bs->file,
                                  cluster_offset + offset_in_cluster,
                                  cur_bytes, &hd_qiov, 0);
            qemu_co_mutex_lock(&s->lock);

Stefan

  reply	other threads:[~2017-11-16 17:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 11:52 [Qemu-devel] Effect of qemu-img convert -m and -W options Richard W.M. Jones
2017-11-16 14:47 ` Stefan Hajnoczi
2017-11-16 14:51   ` Peter Lieven
2017-11-16 15:12     ` Richard W.M. Jones
2017-11-16 17:20       ` Stefan Hajnoczi [this message]
2017-11-16 15:10   ` Richard W.M. Jones
2017-11-16 17:30     ` Stefan Hajnoczi
2017-11-16 18:00       ` Richard W.M. Jones
2017-11-20 15:57         ` 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='CAJSP0QXepBMucAFNSbihp6awkurZ=47fTwgv7UHQ3MRiATGS5w@mail.gmail.com' \
    --to=stefanha@gmail.com \
    --cc=libguestfs@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@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).