[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v3 13/39] qcow2: Add l2_slice_size field to BDRV
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [PATCH v3 13/39] qcow2: Add l2_slice_size field to BDRVQcow2State |
Date: |
Wed, 31 Jan 2018 20:48:08 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 2018-01-26 15:59, Alberto Garcia wrote:
> The BDRVQcow2State structure contains an l2_size field, which stores
> the number of 64-bit entries in an L2 table.
>
> For efficiency reasons we want to be able to load slices instead of
> full L2 tables, so we need to know how many entries an L2 slice can
> hold.
>
> An L2 slice is the portion of an L2 table that is loaded by the qcow2
> cache. At the moment that cache can only load complete tables,
> therefore an L2 slice has the same size as an L2 table (one cluster)
> and l2_size == l2_slice_size.
>
> Later we'll allow smaller slices, but until then we have to use this
> new l2_slice_size field to make the rest of the code ready for that.
>
> Signed-off-by: Alberto Garcia <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>
> ---
> block/qcow2.c | 3 +++
> block/qcow2.h | 1 +
> 2 files changed, 4 insertions(+)
Am I missing something or does this patch miss setting l2_slice_size in
qcow2_do_open()?
Max
> diff --git a/block/qcow2.c b/block/qcow2.c
> index e2d4bf7ad5..78f067cae7 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -805,6 +805,7 @@ static void read_cache_sizes(BlockDriverState *bs,
> QemuOpts *opts,
> typedef struct Qcow2ReopenState {
> Qcow2Cache *l2_table_cache;
> Qcow2Cache *refcount_block_cache;
> + int l2_slice_size; /* Number of entries in a slice of the L2 table */
> bool use_lazy_refcounts;
> int overlap_check;
> bool discard_passthrough[QCOW2_DISCARD_MAX];
> @@ -886,6 +887,7 @@ static int qcow2_update_options_prepare(BlockDriverState
> *bs,
> }
> }
>
> + r->l2_slice_size = s->cluster_size / sizeof(uint64_t);
> r->l2_table_cache = qcow2_cache_create(bs, l2_cache_size);
> r->refcount_block_cache = qcow2_cache_create(bs, refcount_cache_size);
> if (r->l2_table_cache == NULL || r->refcount_block_cache == NULL) {
> @@ -1049,6 +1051,7 @@ static void
> qcow2_update_options_commit(BlockDriverState *bs,
> }
> s->l2_table_cache = r->l2_table_cache;
> s->refcount_block_cache = r->refcount_block_cache;
> + s->l2_slice_size = r->l2_slice_size;
>
> s->overlap_check = r->overlap_check;
> s->use_lazy_refcounts = r->use_lazy_refcounts;
> diff --git a/block/qcow2.h b/block/qcow2.h
> index 0559afbc63..e0aee88811 100644
> --- a/block/qcow2.h
> +++ b/block/qcow2.h
> @@ -251,6 +251,7 @@ typedef struct BDRVQcow2State {
> int cluster_bits;
> int cluster_size;
> int cluster_sectors;
> + int l2_slice_size;
> int l2_bits;
> int l2_size;
> int l1_size;
>
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH v3 28/39] qcow2: Read refcount before L2 table in expand_zero_clusters_in_l1(), (continued)
- [Qemu-block] [PATCH v3 28/39] qcow2: Read refcount before L2 table in expand_zero_clusters_in_l1(), Alberto Garcia, 2018/01/26
- [Qemu-block] [PATCH v3 38/39] iotests: Test downgrading an image using a small L2 slice size, Alberto Garcia, 2018/01/26
- [Qemu-block] [PATCH v3 31/39] qcow2: Update qcow2_truncate() to support L2 slices, Alberto Garcia, 2018/01/26
- [Qemu-block] [PATCH v3 10/39] qcow2: Remove BDS parameter from qcow2_cache_discard(), Alberto Garcia, 2018/01/26
- [Qemu-block] [PATCH v3 08/39] qcow2: Remove BDS parameter from qcow2_cache_destroy(), Alberto Garcia, 2018/01/26
- [Qemu-block] [PATCH v3 13/39] qcow2: Add l2_slice_size field to BDRVQcow2State, Alberto Garcia, 2018/01/26
- Re: [Qemu-block] [PATCH v3 13/39] qcow2: Add l2_slice_size field to BDRVQcow2State,
Max Reitz <=
- [Qemu-block] [PATCH v3 09/39] qcow2: Remove BDS parameter from qcow2_cache_clean_unused(), Alberto Garcia, 2018/01/26
- [Qemu-block] [PATCH v3 11/39] qcow2: Remove BDS parameter from qcow2_cache_is_table_offset(), Alberto Garcia, 2018/01/26
- [Qemu-block] [PATCH v3 25/39] qcow2: Update zero_single_l2() to support L2 slices, Alberto Garcia, 2018/01/26
- [Qemu-block] [PATCH v3 07/39] qcow2: Remove BDS parameter from qcow2_cache_put(), Alberto Garcia, 2018/01/26
- [Qemu-block] [PATCH v3 36/39] qcow2: Allow configuring the L2 slice size, Alberto Garcia, 2018/01/26
- [Qemu-block] [PATCH v3 30/39] qcow2: Update expand_zero_clusters_in_l1() to support L2 slices, Alberto Garcia, 2018/01/26