summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-03-28 11:50:55 +0000
committerVincent Sanders <vince@kyllikki.org>2015-03-31 20:56:55 +0100
commita8e501a6637cef13a056d4be5d5a0fdc5ce4fa27 (patch)
tree39abf2c13d265310edfd2ba3a28ff6662ba50697
parent980e28d916e22d33ec8cea3aa57fdc49d83f1b9e (diff)
downloadnetsurf-a8e501a6637cef13a056d4be5d5a0fdc5ce4fa27.tar.gz
netsurf-a8e501a6637cef13a056d4be5d5a0fdc5ce4fa27.tar.bz2
define block store parameters
-rw-r--r--content/fs_backing_store.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/content/fs_backing_store.c b/content/fs_backing_store.c
index 986e0f68e..4c8f3fc59 100644
--- a/content/fs_backing_store.c
+++ b/content/fs_backing_store.c
@@ -79,6 +79,21 @@
/** Filename of serialised entries */
#define ENTRIES_FNAME "entries"
+/** log2 block data address length (64k) */
+#define BLOCK_ADDR_LEN 16
+
+/** log2 size of data blocks (8k) */
+#define BLOCK_DATA_SIZE 13
+
+/** log2 size of metadata blocks (1k) */
+#define BLOCK_META_SIZE 10
+
+/** log2 number of data block files */
+#define BLOCK_DATA_COUNT (BLOCK_ADDR_LEN - BLOCK_DATA_SIZE)
+
+/** log2 number of metadata block files */
+#define BLOCK_METADATA_COUNT (BLOCK_ADDR_LEN - BLOCK_METADATA_SIZE)
+
/**
* The type used to store index values refering to store entries. Care
* must be taken with this type as it is used to build address to
@@ -168,12 +183,15 @@ struct store_entry {
* Parameters controlling the backing store.
*/
struct store_state {
+ /* store config */
char *path; /**< The path to the backing store */
size_t limit; /**< The backing store upper bound target size */
size_t hysteresis; /**< The hysteresis around the target size */
unsigned int ident_bits; /**< log2 number of bits to use for address. */
+
+ /* cache entry management */
struct store_entry *entries; /**< store entries. */
unsigned int entry_bits; /**< log2 number of bits in entry index. */
unsigned int last_entry; /**< index of last usable entry. */
@@ -191,6 +209,8 @@ struct store_state {
*/
entry_index_t *addrmap;
+
+ /* stats */
uint64_t total_alloc; /**< total size of all allocated storage. */
size_t hit_count; /**< number of cache hits */