Allow offload with FAKEIO engines
[fio.git] / filesetup.c
index a1c60445cc1bb4863ece64c8be935d68f3da91d1..e44f31c716a63eb12440da37fd50d3552db39e10 100644 (file)
@@ -1139,6 +1139,8 @@ int setup_files(struct thread_data *td)
                if (f->io_size == -1ULL)
                        total_size = -1ULL;
                else {
+                       uint64_t io_size;
+
                         if (o->size_percent && o->size_percent != 100) {
                                uint64_t file_size;
 
@@ -1150,7 +1152,14 @@ int setup_files(struct thread_data *td)
 
                                f->io_size -= (f->io_size % td_min_bs(td));
                        }
-                       total_size += f->io_size;
+
+                       io_size = f->io_size;
+                       if (o->io_size_percent && o->io_size_percent != 100) {
+                               io_size *= o->io_size_percent;
+                               io_size /= 100;
+                       }
+
+                       total_size += io_size;
                }
 
                if (f->filetype == FIO_TYPE_FILE &&
@@ -1445,6 +1454,19 @@ void close_files(struct thread_data *td)
        }
 }
 
+void fio_file_free(struct fio_file *f)
+{
+       if (fio_file_axmap(f))
+               axmap_free(f->io_axmap);
+       if (!fio_file_smalloc(f)) {
+               free(f->file_name);
+               free(f);
+       } else {
+               sfree(f->file_name);
+               sfree(f);
+       }
+}
+
 void close_and_free_files(struct thread_data *td)
 {
        struct fio_file *f;
@@ -1469,20 +1491,7 @@ void close_and_free_files(struct thread_data *td)
                }
 
                zbd_close_file(f);
-
-               if (!fio_file_smalloc(f))
-                       free(f->file_name);
-               else
-                       sfree(f->file_name);
-               f->file_name = NULL;
-               if (fio_file_axmap(f)) {
-                       axmap_free(f->io_axmap);
-                       f->io_axmap = NULL;
-               }
-               if (!fio_file_smalloc(f))
-                       free(f);
-               else
-                       sfree(f);
+               fio_file_free(f);
        }
 
        td->o.filename = NULL;