+ struct flist_head *entry;
+ char *filename;
+
+ if (flist_empty(&filename_list))
+ return 0;
+
+ flist_for_each(entry, &filename_list) {
+ filename = flist_entry(entry, struct file_name, list)->filename;
+
+ if (strcmp(filename, fname) == 0)
+ return 1;
+ }
+
+ return 0;
+}
+
+static int is_already_allocated(const char *fname)
+{
+ int ret;
+
+ fio_file_hash_lock();
+ ret = __is_already_allocated(fname);
+ fio_file_hash_unlock();
+ return ret;
+}
+
+static void set_already_allocated(const char *fname)
+{
+ struct file_name *fn;
+
+ fn = malloc(sizeof(struct file_name));
+ fn->filename = strdup(fname);
+
+ fio_file_hash_lock();
+ if (!__is_already_allocated(fname)) {
+ flist_add_tail(&fn->list, &filename_list);
+ fn = NULL;
+ }
+ fio_file_hash_unlock();
+
+ if (fn) {
+ free(fn->filename);
+ free(fn);
+ }
+}