#include "flist.h"
#include "hash.h"
#include "filehash.h"
+#include "smalloc.h"
#include "lib/bloom.h"
#define HASH_BUCKETS 512
#define BLOOM_SIZE 16*1024*1024
-unsigned int file_hash_size = HASH_BUCKETS * sizeof(struct flist_head);
+static unsigned int file_hash_size = HASH_BUCKETS * sizeof(struct flist_head);
static struct flist_head *file_hash;
static struct fio_mutex *hash_lock;
if (has_entries)
log_err("fio: file hash not empty on exit\n");
+ sfree(file_hash);
file_hash = NULL;
fio_mutex_remove(hash_lock);
hash_lock = NULL;
file_bloom = NULL;
}
-void file_hash_init(void *ptr)
+void file_hash_init(void)
{
unsigned int i;
- file_hash = ptr;
+ file_hash = smalloc(file_hash_size);
+
for (i = 0; i < HASH_BUCKETS; i++)
INIT_FLIST_HEAD(&file_hash[i]);
#include "lib/types.h"
-extern unsigned int file_hash_size;
-
-extern void file_hash_init(void *);
+extern void file_hash_init(void);
extern void file_hash_exit(void);
extern struct fio_file *lookup_file_hash(const char *);
extern struct fio_file *add_file_hash(struct fio_file *);
do {
size_t size = max_jobs * sizeof(struct thread_data);
- size += file_hash_size;
size += sizeof(unsigned int);
#ifndef CONFIG_NO_SHM
#endif
memset(threads, 0, max_jobs * sizeof(struct thread_data));
- hash = (void *) threads + max_jobs * sizeof(struct thread_data);
- fio_debug_jobp = (void *) hash + file_hash_size;
+ fio_debug_jobp = (void *) threads + max_jobs * sizeof(struct thread_data);
*fio_debug_jobp = -1;
- file_hash_init(hash);
+ file_hash_init();
flow_init();
return 0;