Change the internal mapping to a tree of chunk

This is intended to save memory as now we can use a fixed
block of 17 bytes to store the block information, compared
to the previous 28/36 bytes.
This commit is contained in:
Andrea Mazzoleni 2015-10-04 22:02:05 +02:00
parent fa775d24a8
commit 9bc5f9e5ce
12 changed files with 900 additions and 258 deletions

View file

@ -78,14 +78,14 @@ void memory(void)
{
log_tag("memory:used:%" PRIu64 "\n", (uint64_t)malloc_counter());
/* size of the block + the size of the blockarr pointer to it */
log_tag("memory:block:%" PRIu64 "\n", (uint64_t)(sizeof(struct snapraid_block) + sizeof(void*)));
/* size of the file + the size of the 3 hashtables pointers to it, * 2 for the hashtable grow factor */
log_tag("memory:file:%" PRIu64 "\n", (uint64_t)(sizeof(struct snapraid_file) + 3*2*sizeof(void*)));
/* size of the block */
log_tag("memory:block:%" PRIu64 "\n", (uint64_t)(sizeof(struct snapraid_block)));
log_tag("memory:chunk:%" PRIu64 "\n", (uint64_t)(sizeof(struct snapraid_chunk)));
log_tag("memory:file:%" PRIu64 "\n", (uint64_t)(sizeof(struct snapraid_file)));
log_tag("memory:link:%" PRIu64 "\n", (uint64_t)(sizeof(struct snapraid_link)));
log_tag("memory:dir:%" PRIu64 "\n", (uint64_t)(sizeof(struct snapraid_dir)));
msg_progress("Using %u MiB of memory.\n", (unsigned)(malloc_counter() / (1024 * 1024)));
}
/****************************************************************************/