Add close_files() that closes all files
authorJens Axboe <jens.axboe@oracle.com>
Sat, 1 Mar 2008 14:47:08 +0000 (15:47 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Sat, 1 Mar 2008 14:47:08 +0000 (15:47 +0100)
Renames the current implementation to close_and_free_files(), since
that is what it actually does.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
filesetup.c
fio.c
fio.h

index b29db3f3f237032db28c1ec1d4fdc4cc6b6c050f..3e11c4c651050889457e37ccca6160204e81d0dd 100644 (file)
@@ -520,6 +520,15 @@ void close_files(struct thread_data *td)
        struct fio_file *f;
        unsigned int i;
 
+       for_each_file(td, f, i)
+               td_io_close_file(td, f);
+}
+
+void close_and_free_files(struct thread_data *td)
+{
+       struct fio_file *f;
+       unsigned int i;
+
        dprint(FD_FILE, "close files\n");
 
        for_each_file(td, f, i) {
diff --git a/fio.c b/fio.c
index d345064d392111e50accdb70db9fe2d43f45ab09..c609f55d8e9520672e8c1e67e8c7b811dbceb002 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -787,8 +787,7 @@ static int clear_io_state(struct thread_data *td)
        if (td->o.time_based || td->o.loops)
                td->nr_done_files = 0;
 
-       for_each_file(td, f, i)
-               td_io_close_file(td, f);
+       close_files(td);
 
        ret = 0;
        for_each_file(td, f, i) {
@@ -966,7 +965,7 @@ static void *thread_main(void *data)
 err:
        if (td->error)
                printf("fio: pid=%d, err=%d/%s\n", td->pid, td->error, td->verror);
-       close_files(td);
+       close_and_free_files(td);
        close_ioengine(td);
        cleanup_io_u(td);
 
diff --git a/fio.h b/fio.h
index d7875b04cf82bdd8981ddaa1eec5691f65301eb6..4fbc704498aa521519c903cfea88466daa2e25cc 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -800,6 +800,7 @@ extern void options_mem_free(struct thread_data *);
  * File setup/shutdown
  */
 extern void close_files(struct thread_data *);
+extern void close_and_free_files(struct thread_data *);
 extern int __must_check setup_files(struct thread_data *);
 extern int __must_check open_files(struct thread_data *);
 extern int __must_check file_invalidate_cache(struct thread_data *, struct fio_file *);