[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 04/39] qcow2: Remove BDS parameter from qcow2_cac
From: |
Alberto Garcia |
Subject: |
[Qemu-devel] [PATCH v4 04/39] qcow2: Remove BDS parameter from qcow2_cache_get_table_idx() |
Date: |
Mon, 5 Feb 2018 16:33:04 +0200 |
This function was only using the BlockDriverState parameter to get the
cache table size (since it was equal to the cluster size). This is no
longer necessary so this parameter can be removed.
Signed-off-by: Alberto Garcia <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
---
block/qcow2-cache.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c
index a481ef499a..3749d55595 100644
--- a/block/qcow2-cache.c
+++ b/block/qcow2-cache.c
@@ -51,8 +51,7 @@ static inline void *qcow2_cache_get_table_addr(Qcow2Cache *c,
int table)
return (uint8_t *) c->table_array + (size_t) table * c->table_size;
}
-static inline int qcow2_cache_get_table_idx(BlockDriverState *bs,
- Qcow2Cache *c, void *table)
+static inline int qcow2_cache_get_table_idx(Qcow2Cache *c, void *table)
{
ptrdiff_t table_offset = (uint8_t *) table - (uint8_t *) c->table_array;
int idx = table_offset / c->table_size;
@@ -411,7 +410,7 @@ int qcow2_cache_get_empty(BlockDriverState *bs, Qcow2Cache
*c, uint64_t offset,
void qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table)
{
- int i = qcow2_cache_get_table_idx(bs, c, *table);
+ int i = qcow2_cache_get_table_idx(c, *table);
c->entries[i].ref--;
*table = NULL;
@@ -426,7 +425,7 @@ void qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c,
void **table)
void qcow2_cache_entry_mark_dirty(BlockDriverState *bs, Qcow2Cache *c,
void *table)
{
- int i = qcow2_cache_get_table_idx(bs, c, table);
+ int i = qcow2_cache_get_table_idx(c, table);
assert(c->entries[i].offset != 0);
c->entries[i].dirty = true;
}
@@ -446,7 +445,7 @@ void *qcow2_cache_is_table_offset(BlockDriverState *bs,
Qcow2Cache *c,
void qcow2_cache_discard(BlockDriverState *bs, Qcow2Cache *c, void *table)
{
- int i = qcow2_cache_get_table_idx(bs, c, table);
+ int i = qcow2_cache_get_table_idx(c, table);
assert(c->entries[i].ref == 0);
--
2.11.0
- [Qemu-devel] [PATCH v4 00/39] Allow configuring the qcow2 L2 cache entry size, Alberto Garcia, 2018/02/05
- [Qemu-devel] [PATCH v4 05/39] qcow2: Remove BDS parameter from qcow2_cache_table_release(), Alberto Garcia, 2018/02/05
- [Qemu-devel] [PATCH v4 24/39] qcow2: Update discard_single_l2() to support L2 slices, Alberto Garcia, 2018/02/05
- [Qemu-devel] [PATCH v4 17/39] qcow2: Update l2_allocate() to support L2 slices, Alberto Garcia, 2018/02/05
- [Qemu-devel] [PATCH v4 04/39] qcow2: Remove BDS parameter from qcow2_cache_get_table_idx(),
Alberto Garcia <=
- [Qemu-devel] [PATCH v4 06/39] qcow2: Remove BDS parameter from qcow2_cache_entry_mark_dirty(), Alberto Garcia, 2018/02/05
- [Qemu-devel] [PATCH v4 08/39] qcow2: Remove BDS parameter from qcow2_cache_destroy(), Alberto Garcia, 2018/02/05
- [Qemu-devel] [PATCH v4 35/39] qcow2: Rename l2_table in count_cow_clusters(), Alberto Garcia, 2018/02/05
- [Qemu-devel] [PATCH v4 10/39] qcow2: Remove BDS parameter from qcow2_cache_discard(), Alberto Garcia, 2018/02/05
- [Qemu-devel] [PATCH v4 07/39] qcow2: Remove BDS parameter from qcow2_cache_put(), Alberto Garcia, 2018/02/05
- [Qemu-devel] [PATCH v4 15/39] qcow2: Update l2_load() to support L2 slices, Alberto Garcia, 2018/02/05
- [Qemu-devel] [PATCH v4 20/39] qcow2: Update qcow2_get_cluster_offset() to support L2 slices, Alberto Garcia, 2018/02/05
- [Qemu-devel] [PATCH v4 13/39] qcow2: Add l2_slice_size field to BDRVQcow2State, Alberto Garcia, 2018/02/05
- [Qemu-devel] [PATCH v4 11/39] qcow2: Remove BDS parameter from qcow2_cache_is_table_offset(), Alberto Garcia, 2018/02/05
- [Qemu-devel] [PATCH v4 12/39] qcow2: Add offset_to_l1_index(), Alberto Garcia, 2018/02/05