From: Jens Axboe Date: Mon, 9 Oct 2017 18:37:14 +0000 (-0600) Subject: filesetup: don't track file allocation for jobs == 1 X-Git-Tag: fio-3.2~56 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=084a5475d55b6cad7550e56a46d8797e8534bb2d filesetup: don't track file allocation for jobs == 1 We only really need this for multiple jobs, and we only check it if we are in job > 1. But we always mark the file as allocated. For jobs with lots of files (millions), this takes a long time to do at setup time. Running this sample job: ./fio --alloc-size=131072 --name=filecreate --ioengine=filecreate --size=1g --nr_files=1m --openfiles=256 takes ~16s before, and about ~7s afterwards. Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index 891a55a1..789f0ed2 100644 --- a/filesetup.c +++ b/filesetup.c @@ -1588,7 +1588,8 @@ int add_file(struct thread_data *td, const char *fname, int numjob, int inc) if (f->filetype == FIO_TYPE_FILE) td->nr_normal_files++; - set_already_allocated(file_name); + if (td->o.numjobs > 1) + set_already_allocated(file_name); if (inc) td->o.nr_files++;