[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 02/32] qcow2: Add table size field to Qcow2Ca
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 02/32] qcow2: Add table size field to Qcow2Cache |
Date: |
Tue, 16 Jan 2018 15:05:08 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 12/15/2017 06:53 AM, Alberto Garcia wrote:
> The table size in the qcow2 cache is currently equal to the cluster
> size. This doesn't allow us to use the cache memory efficiently,
> particularly with large cluster sizes, so we need to be able to have
> smaller cache tables that are independent from the cluster size. This
> patch adds a new field to Qcow2Cache that we can use instead of the
> cluster size.
>
> The current table size is still being initialized to the cluster size,
> so there are no semantic changes yet, but this patch will allow us to
> prepare the rest of the code and simplify a few function calls.
>
> Signed-off-by: Alberto Garcia <address@hidden>
> ---
> block/qcow2-cache.c | 29 ++++++++++++++---------------
> 1 file changed, 14 insertions(+), 15 deletions(-)
>
> diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c
Reviewed-by: Eric Blake <address@hidden>
>
> @@ -331,7 +330,7 @@ static int qcow2_cache_do_get(BlockDriverState *bs,
> Qcow2Cache *c,
> trace_qcow2_cache_get(qemu_coroutine_self(), c == s->l2_table_cache,
> offset, read_from_disk);
>
> - if (offset_into_cluster(s, offset)) {
> + if (offset & (c->table_size - 1)) {
Worth writing that as QEMU_IS_ALIGNED(offset, c->table_size) instead of
open-coding the bit-wise math?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v2 02/32] qcow2: Add table size field to Qcow2Cache,
Eric Blake <=