[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 29/55] qcow2: Add l2_slice_size field to BDRVQcow2Sta
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 29/55] qcow2: Add l2_slice_size field to BDRVQcow2State |
Date: |
Tue, 13 Feb 2018 18:05:03 +0100 |
From: Alberto Garcia <address@hidden>
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>
Reviewed-by: Max Reitz <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block/qcow2.h | 1 +
block/qcow2.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/block/qcow2.h b/block/qcow2.h
index d9ba57c030..45fb7f4299 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;
diff --git a/block/qcow2.c b/block/qcow2.c
index 461cc7ab1c..ba8d71c72d 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -807,6 +807,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];
@@ -888,6 +889,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) {
@@ -1051,6 +1053,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;
--
2.13.6
- [Qemu-block] [PULL 14/55] sheepdog: Pass old and new size to sd_prealloc(), (continued)
- [Qemu-block] [PULL 14/55] sheepdog: Pass old and new size to sd_prealloc(), Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 12/55] gluster: Add preallocated truncation, Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 18/55] qcow2: Add table size field to Qcow2Cache, Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 19/55] qcow2: Remove BDS parameter from qcow2_cache_get_table_addr(), Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 20/55] qcow2: Remove BDS parameter from qcow2_cache_get_table_idx(), Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 21/55] qcow2: Remove BDS parameter from qcow2_cache_table_release(), Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 26/55] qcow2: Remove BDS parameter from qcow2_cache_discard(), Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 16/55] block: maintain persistent disabled bitmaps, Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 23/55] qcow2: Remove BDS parameter from qcow2_cache_put(), Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 22/55] qcow2: Remove BDS parameter from qcow2_cache_entry_mark_dirty(), Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 29/55] qcow2: Add l2_slice_size field to BDRVQcow2State,
Kevin Wolf <=
- [Qemu-block] [PULL 24/55] qcow2: Remove BDS parameter from qcow2_cache_destroy(), Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 28/55] qcow2: Add offset_to_l1_index(), Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 37/55] qcow2: Update qcow2_alloc_cluster_link_l2() to support L2 slices, Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 35/55] qcow2: Update get_cluster_table() to support L2 slices, Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 33/55] qcow2: Update l2_allocate() to support L2 slices, Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 25/55] qcow2: Remove BDS parameter from qcow2_cache_clean_unused(), Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 38/55] qcow2: Update handle_copied() to support L2 slices, Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 30/55] qcow2: Add offset_to_l2_slice_index(), Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 27/55] qcow2: Remove BDS parameter from qcow2_cache_is_table_offset(), Kevin Wolf, 2018/02/13
- [Qemu-block] [PULL 31/55] qcow2: Update l2_load() to support L2 slices, Kevin Wolf, 2018/02/13