From 440ba08aea3d841996efaf6a6b88426b0d59abf4 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Mon, 18 Aug 2014 22:07:31 +0200 Subject: qcow2: Constant cache size in bytes Specifying the metadata cache sizes in clusters results in less clusters (and much less bytes) covered for small cluster sizes and vice versa. Using a constant byte size reduces this difference, and makes it possible to manually specify the cache size in an easily comprehensible unit. Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- block/qcow2.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'block/qcow2.h') diff --git a/block/qcow2.h b/block/qcow2.h index b49424b85e..671783defe 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -64,10 +64,16 @@ #define MIN_CLUSTER_BITS 9 #define MAX_CLUSTER_BITS 21 -#define L2_CACHE_SIZE 16 +#define MIN_L2_CACHE_SIZE 1 /* cluster */ /* Must be at least 4 to cover all cases of refcount table growth */ -#define REFCOUNT_CACHE_SIZE 4 +#define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */ + +#define DEFAULT_L2_CACHE_BYTE_SIZE 1048576 /* bytes */ + +/* The refblock cache needs only a fourth of the L2 cache size to cover as many + * clusters */ +#define DEFAULT_L2_REFCOUNT_SIZE_RATIO 4 #define DEFAULT_CLUSTER_SIZE 65536 -- cgit v1.2.3