aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Garcia <berto@igalia.com>2018-02-05 16:33:04 +0200
committerMax Reitz <mreitz@redhat.com>2018-02-13 16:59:58 +0100
commitb3b8b6d9c4c7885e39bebe02abf60855c233dc5c (patch)
tree16fe04aaaeb8c01b7b86aa4bc1347b23bb558ea7
parent9869b27bb5c1c08f175804d287efc7b3c6a94e33 (diff)
qcow2: Remove BDS parameter from qcow2_cache_get_table_idx()
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 <berto@igalia.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: da3575d47c9a181a2cfd4715e53dd84a2c651017.1517840876.git.berto@igalia.com Signed-off-by: Max Reitz <mreitz@redhat.com>
-rw-r--r--block/qcow2-cache.c9
1 files 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);