Fix refill buffers overwriting verify data
[fio.git] / filehash.c
index 1bcfc6de072a34d295e34fae04d6a2fd3eb3d6e8..54cea990f927c158c3987bca29904e9e2bc47b98 100644 (file)
@@ -13,21 +13,6 @@ unsigned int file_hash_size = HASH_BUCKETS * sizeof(struct list_head);
 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;
@@ -60,7 +45,6 @@ static struct fio_file *__lookup_file_hash(const char *name)
                }
        }
 
-       dump_hash();
        return NULL;
 }
 
@@ -95,6 +79,23 @@ struct fio_file *add_file_hash(struct fio_file *f)
        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;