static struct list_head *file_hash;
static struct fio_mutex *hash_lock;
-static void dump_hash(void)
-{
- struct list_head *n;
- unsigned int i;
-
- for (i = 0; i < HASH_BUCKETS; i++) {
- list_for_each(n, &file_hash[i]) {
- struct fio_file *f;
-
- f = list_entry(n, struct fio_file, hash_list);
- printf("%d: %s\n", i, f->file_name);
- }
- }
-}
-
static unsigned short hash(const char *name)
{
return crc16((const unsigned char *) name, strlen(name)) & HASH_MASK;
}
}
- dump_hash();
return NULL;
}
return alias;
}
+void file_hash_exit(void)
+{
+ unsigned int i, has_entries = 0;
+
+ fio_mutex_down(hash_lock);
+ for (i = 0; i < HASH_BUCKETS; i++)
+ has_entries += !list_empty(&file_hash[i]);
+ fio_mutex_up(hash_lock);
+
+ if (has_entries)
+ log_err("fio: file hash not empty on exit\n");
+
+ file_hash = NULL;
+ fio_mutex_remove(hash_lock);
+ hash_lock = NULL;
+}
+
void file_hash_init(void *ptr)
{
unsigned int i;