From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"qemu-block@nongnu.org" <qemu-block@nongnu.org>,
"armbru@redhat.com" <armbru@redhat.com>,
"fam@euphon.net" <fam@euphon.net>,
"stefanha@redhat.com" <stefanha@redhat.com>,
"mreitz@redhat.com" <mreitz@redhat.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
Denis Lunev <den@virtuozzo.com>
Subject: Re: [Qemu-devel] [PATCH] block: don't probe zeroes in bs->file by default on block_status
Date: Thu, 24 Jan 2019 09:49:19 -0600 [thread overview]
Message-ID: <9a32c574-5ddb-eca0-1e2c-50b9cc6a7a00@redhat.com> (raw)
In-Reply-To: <20190124153945.GJ4601@localhost.localdomain>
[-- Attachment #1: Type: text/plain, Size: 1918 bytes --]
On 1/24/19 9:39 AM, Kevin Wolf wrote:
>>>
>>> Hmm, and one more idea from Den:
>>>
>>> We can detect preallocated image, comparing allocated size of real file with
>>> number of non-zero qcow2 refcounts. So, real allocation is much less than
>>> allocation in qcow2 point of view, we'll enable lseeks, otherwise - not.
>>>
>>
>> Kevin, what do you think?
>
> I'm unsure. I think it requires scanning all refcount blocks in
> qcow2_open(), right? This could be slow on huge images. On the other
> hand, the first cluster allocation will probably do this anyway, so it
> might be reasonable enough.
>
We could add a qcow2 header to cache the last known values, to make
things faster on open (will only benefit users that know to set/read the
cache; should probably be an autoclear-type feature to detect when an
older user modified the image but not the cache).
We can on first allocation for images being modified - but the use case
in question is 'qemu-img convert' which only reads the image, not writes
it, so yes, it adds a startup delay. But if the delay is no worse than
the current code, or if it can end early, it may help. We're using it
as some sort of heuristic; we need to compare the size of the underlying
file to the count of known-allocated clusters in the qcow2 layer (where
internal snapshots may throw things off, and where having a backing file
or not changes whether a sparse file is worth further checking for extra
precision for encountering holes on allocated clusters).
> How would you communicate this? Another block_status return flag that
> says "don't bother to ask the protocol layer" and which we would only
> set in qcow2 if the probing came to the conclusion that it's not
> preallocated?
That could work.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-01-24 15:49 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 13:20 [Qemu-devel] [PATCH] block: don't probe zeroes in bs->file by default on block_status Vladimir Sementsov-Ogievskiy
2019-01-10 20:51 ` Eric Blake
2019-01-11 7:54 ` Vladimir Sementsov-Ogievskiy
2019-01-11 10:13 ` Vladimir Sementsov-Ogievskiy
2019-01-11 16:02 ` Eric Blake
2019-01-11 16:05 ` Eric Blake
2019-01-11 16:22 ` Vladimir Sementsov-Ogievskiy
2019-01-11 17:12 ` Eric Blake
2019-01-11 10:41 ` Kevin Wolf
2019-01-11 11:40 ` Vladimir Sementsov-Ogievskiy
2019-01-11 12:21 ` Kevin Wolf
2019-01-11 12:59 ` Vladimir Sementsov-Ogievskiy
2019-01-11 13:15 ` Kevin Wolf
2019-01-11 16:09 ` Vladimir Sementsov-Ogievskiy
2019-01-11 17:04 ` Eric Blake
2019-01-11 17:27 ` Vladimir Sementsov-Ogievskiy
2019-01-22 18:57 ` Kevin Wolf
2019-01-23 11:53 ` Vladimir Sementsov-Ogievskiy
2019-01-23 16:33 ` Kevin Wolf
2019-01-24 14:36 ` Vladimir Sementsov-Ogievskiy
2019-01-24 15:31 ` Kevin Wolf
2019-01-24 15:47 ` Vladimir Sementsov-Ogievskiy
2019-01-23 12:04 ` Vladimir Sementsov-Ogievskiy
2019-01-24 14:37 ` Vladimir Sementsov-Ogievskiy
2019-01-24 15:39 ` Kevin Wolf
2019-01-24 15:49 ` Eric Blake [this message]
2019-01-24 15:53 ` Vladimir Sementsov-Ogievskiy
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=9a32c574-5ddb-eca0-1e2c-50b9cc6a7a00@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=den@virtuozzo.com \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.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).