All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org, Alberto Garcia <berto@igalia.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 1/6] qcow2: use one single memory block for the L2/refcount cache tables
Date: Wed, 6 May 2015 15:57:08 +0100	[thread overview]
Message-ID: <20150506145708.GD2386@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <20150505112019.GB3866@noname.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1604 bytes --]

On Tue, May 05, 2015 at 01:20:19PM +0200, Kevin Wolf wrote:
> Am 05.05.2015 um 12:28 hat Stefan Hajnoczi geschrieben:
> > On Mon, May 04, 2015 at 12:58:13PM +0200, Kevin Wolf wrote:
> > > Am 01.05.2015 um 16:23 hat Stefan Hajnoczi geschrieben:
> > > > On Thu, Apr 30, 2015 at 01:11:40PM +0300, Alberto Garcia wrote:
> > > > >  Qcow2Cache *qcow2_cache_create(BlockDriverState *bs, int num_tables)
> > > > >  {
> > > > >      BDRVQcowState *s = bs->opaque;
> > > > >      Qcow2Cache *c;
> > > > > -    int i;
> > > > >  
> > > > >      c = g_new0(Qcow2Cache, 1);
> > > > >      c->size = num_tables;
> > > > > +    c->table_size = s->cluster_size;
> > > > 
> > > > This assumes c->table_size meets bs' memory alignment requirements.  The
> > > > following would be safer:
> > > > 
> > > > c->table_size = QEMU_ALIGN_UP(c->table_size, bdrv_opt_mem_align(bs->file));
> > > 
> > > You can't just access more than one cluster. You might be caching data
> > > and later write it back when it's stale.
> > 
> > I don't mean I/O alignment, just memory alignment (i.e. the start
> > address of the data buffer in memory).
> 
> The start address is already taken care of by qemu_blockalign(). With
> rounding c->table_size, you'd align the length, and that would be wrong.

It wasn't clear to me that c->table + n * c->table_size for all n is
aligned, but I agree with you now:

bdrv_qiov_is_aligned() checks both address and size against memory
alignment.  This means that if the I/O is memory aligned for table_size,
then all multiples of table_size are also aligned.

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

  parent reply	other threads:[~2015-05-06 14:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30 10:11 [Qemu-devel] [PATCH 0/6] qcow2 L2/refcount cache improvements Alberto Garcia
2015-04-30 10:11 ` [Qemu-devel] [PATCH 1/6] qcow2: use one single memory block for the L2/refcount cache tables Alberto Garcia
2015-04-30 15:08   ` Eric Blake
2015-05-05 13:00     ` Alberto Garcia
2015-05-01 14:23   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2015-05-04 10:58     ` Kevin Wolf
2015-05-05 10:28       ` Stefan Hajnoczi
2015-05-05 11:20         ` Kevin Wolf
2015-05-05 15:09           ` Alberto Garcia
2015-05-06 14:57           ` Stefan Hajnoczi [this message]
2015-04-30 10:11 ` [Qemu-devel] [PATCH 2/6] qcow2: simplify qcow2_cache_put() and qcow2_cache_entry_mark_dirty() Alberto Garcia
2015-05-01 14:31   ` Stefan Hajnoczi
2015-05-05 13:06     ` Alberto Garcia
2015-05-06 15:00       ` Stefan Hajnoczi
2015-05-06 15:32         ` Alberto Garcia
2015-05-05 15:21   ` Eric Blake
2015-04-30 10:11 ` [Qemu-devel] [PATCH 3/6] qcow2: use an LRU algorithm to replace entries from the L2 cache Alberto Garcia
2015-04-30 10:11 ` [Qemu-devel] [PATCH 4/6] qcow2: remove qcow2_cache_find_entry_to_replace() Alberto Garcia
2015-04-30 10:11 ` [Qemu-devel] [PATCH 5/6] qcow2: use a hash to look for entries in the L2 cache Alberto Garcia
2015-05-06 16:42   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2015-05-07  8:23     ` Alberto Garcia
2015-04-30 10:11 ` [Qemu-devel] [PATCH 6/6] qcow2: style fixes in qcow2-cache.c Alberto Garcia
2015-05-06 16:42   ` Stefan Hajnoczi
2015-05-06 16:43 ` [Qemu-devel] [Qemu-block] [PATCH 0/6] qcow2 L2/refcount cache improvements 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=20150506145708.GD2386@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=berto@igalia.com \
    --cc=kwolf@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.