[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v2 03/32] qcow2: Remove BDS parameter from qcow2_cac
From: |
Alberto Garcia |
Subject: |
[Qemu-block] [PATCH v2 03/32] qcow2: Remove BDS parameter from qcow2_cache_get_table_addr() |
Date: |
Fri, 15 Dec 2017 13:53:31 +0100 |
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>
---
block/qcow2-cache.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c
index d068fed98e..ff793fc532 100644
--- a/block/qcow2-cache.c
+++ b/block/qcow2-cache.c
@@ -46,8 +46,7 @@ struct Qcow2Cache {
uint64_t cache_clean_lru_counter;
};
-static inline void *qcow2_cache_get_table_addr(BlockDriverState *bs,
- Qcow2Cache *c, int table)
+static inline void *qcow2_cache_get_table_addr(Qcow2Cache *c, int table)
{
return (uint8_t *) c->table_array + (size_t) table * c->table_size;
}
@@ -78,7 +77,7 @@ static void qcow2_cache_table_release(BlockDriverState *bs,
Qcow2Cache *c,
{
/* Using MADV_DONTNEED to discard memory is a Linux-specific feature */
#ifdef CONFIG_LINUX
- void *t = qcow2_cache_get_table_addr(bs, c, i);
+ void *t = qcow2_cache_get_table_addr(c, i);
int align = getpagesize();
size_t mem_size = (size_t) c->table_size * num_tables;
size_t offset = QEMU_ALIGN_UP((uintptr_t) t, align) - (uintptr_t) t;
@@ -222,7 +221,7 @@ static int qcow2_cache_entry_flush(BlockDriverState *bs,
Qcow2Cache *c, int i)
}
ret = bdrv_pwrite(bs->file, c->entries[i].offset,
- qcow2_cache_get_table_addr(bs, c, i), c->table_size);
+ qcow2_cache_get_table_addr(c, i), c->table_size);
if (ret < 0) {
return ret;
}
@@ -378,7 +377,7 @@ static int qcow2_cache_do_get(BlockDriverState *bs,
Qcow2Cache *c,
}
ret = bdrv_pread(bs->file, offset,
- qcow2_cache_get_table_addr(bs, c, i),
+ qcow2_cache_get_table_addr(c, i),
c->table_size);
if (ret < 0) {
return ret;
@@ -390,7 +389,7 @@ static int qcow2_cache_do_get(BlockDriverState *bs,
Qcow2Cache *c,
/* And return the right table */
found:
c->entries[i].ref++;
- *table = qcow2_cache_get_table_addr(bs, c, i);
+ *table = qcow2_cache_get_table_addr(c, i);
trace_qcow2_cache_get_done(qemu_coroutine_self(),
c == s->l2_table_cache, i);
@@ -439,7 +438,7 @@ void *qcow2_cache_is_table_offset(BlockDriverState *bs,
Qcow2Cache *c,
for (i = 0; i < c->size; i++) {
if (c->entries[i].offset == offset) {
- return qcow2_cache_get_table_addr(bs, c, i);
+ return qcow2_cache_get_table_addr(c, i);
}
}
return NULL;
--
2.11.0
- [Qemu-block] [PATCH v2 22/32] qcow2: Update discard_single_l2() to support L2 slices, (continued)
- [Qemu-block] [PATCH v2 22/32] qcow2: Update discard_single_l2() to support L2 slices, Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 14/32] qcow2: Add offset_to_l2_slice_index(), Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 29/32] qcow2: Rename l2_table in count_contiguous_clusters_unallocated(), Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 13/32] qcow2: Add l2_slice_size field to BDRVQcow2State, Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 26/32] qcow2: Update qcow2_truncate() to support L2 slices, Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 28/32] qcow2: Rename l2_table in count_contiguous_clusters(), Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 32/32] iotests: Add test for l2-cache-entry-size, Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 04/32] qcow2: Remove BDS parameter from qcow2_cache_get_table_idx(), Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 27/32] qcow2: Rename l2_table in qcow2_alloc_compressed_cluster_offset(), Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 08/32] qcow2: Remove BDS parameter from qcow2_cache_destroy(), Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 03/32] qcow2: Remove BDS parameter from qcow2_cache_get_table_addr(),
Alberto Garcia <=
- [Qemu-block] [PATCH v2 01/32] qcow2: Fix documentation of get_cluster_table(), Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 09/32] qcow2: Remove BDS parameter from qcow2_cache_clean_unused(), Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 11/32] qcow2: Remove BDS parameter from qcow2_cache_is_table_offset(), Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 23/32] qcow2: Update zero_single_l2() to support L2 slices, Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 06/32] qcow2: Remove BDS parameter from qcow2_cache_entry_mark_dirty(), Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 31/32] qcow2: Allow configuring the L2 slice size, Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 05/32] qcow2: Remove BDS parameter from qcow2_cache_table_release(), Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 15/32] qcow2: Update l2_load() to support L2 slices, Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 21/32] qcow2: Update handle_alloc() to support L2 slices, Alberto Garcia, 2017/12/15
- [Qemu-block] [PATCH v2 18/32] qcow2: Update qcow2_get_cluster_offset() to support L2 slices, Alberto Garcia, 2017/12/15