From: Jens Axboe Date: Sat, 1 Mar 2008 14:47:08 +0000 (+0100) Subject: Add close_files() that closes all files X-Git-Tag: fio-1.20-rc1~27 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=24ffd2c2bca53f4de85ab6defd52a812be1f2429 Add close_files() that closes all files Renames the current implementation to close_and_free_files(), since that is what it actually does. Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index b29db3f3..3e11c4c6 100644 --- a/filesetup.c +++ b/filesetup.c @@ -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 d345064d..c609f55d 100644 --- 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 d7875b04..4fbc7044 100644 --- 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 *);