From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: vsementsov@virtuozzo.com, mreitz@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] file-posix: Cache lseek result for data regions
Date: Thu, 24 Jan 2019 09:56:00 -0600 [thread overview]
Message-ID: <f314a45b-72d4-bc00-07a4-1437c58d286a@redhat.com> (raw)
In-Reply-To: <20190124141731.21509-1-kwolf@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1586 bytes --]
On 1/24/19 8:17 AM, Kevin Wolf wrote:
> Depending on the exact image layout and the storage backend (tmpfs is
> konwn to have very slow SEEK_HOLE/SEEK_DATA), caching lseek results can
> save us a lot of time e.g. during a mirror block job or qemu-img convert
> with a fragmented source image (.bdrv_co_block_status on the protocol
> layer can be called for every single cluster in the extreme case).
>
> We may only cache data regions because of possible concurrent writers.
> This means that we can later treat a recently punched hole as data, but
> this is safe. We can't cache holes because then we might treat recently
> written data as holes, which can cause corruption.
gluster copies heavily from file-posix's implementation; should it also
copy this cache of known-data? Should NBD also cache known-data when
NBD_CMD_BLOCK_STATUS is available?
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block/file-posix.c | 51 ++++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 49 insertions(+), 2 deletions(-)
>
>
> + /* Invalidate seek_data_cache if it overlaps */
> + sdc = &s->seek_data_cache;
> + if (sdc->valid && !(sdc->end < aiocb->aio_offset ||
> + sdc->start > aiocb->aio_offset + aiocb->aio_nbytes))
> + {
> + sdc->valid = false;
> + }
Worth a helper function for this repeated action?
Reviewed-by: Eric Blake <eblake@redhat.com>
--
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:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-24 14:17 [Qemu-devel] [PATCH] file-posix: Cache lseek result for data regions Kevin Wolf
2019-01-24 14:40 ` Vladimir Sementsov-Ogievskiy
2019-01-24 15:11 ` Kevin Wolf
2019-01-24 15:22 ` Vladimir Sementsov-Ogievskiy
2019-01-24 15:42 ` Kevin Wolf
2019-01-25 10:10 ` Paolo Bonzini
2019-01-25 10:30 ` Kevin Wolf
2019-02-04 10:17 ` Paolo Bonzini
2019-01-24 15:56 ` Eric Blake [this message]
2019-01-29 10:56 ` Kevin Wolf
2019-01-29 21:03 ` Eric Blake
2019-01-24 16:18 ` Vladimir Sementsov-Ogievskiy
2019-01-24 16:36 ` Kevin Wolf
2019-01-25 9:13 ` Vladimir Sementsov-Ogievskiy
2019-01-25 13:26 ` Eric Blake
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=f314a45b-72d4-bc00-07a4-1437c58d286a@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--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).