From 8f9cc4a9928d057945becd351c858c3433934465 Mon Sep 17 00:00:00 2001 From: Gurudas Pai Date: Fri, 21 Dec 2007 10:50:33 +0100 Subject: [PATCH] fio: Fix for new file creation fio fails to create new file and just comes out without doing anything.. This happens only when you are creating file freshly. ./fio ../jobfile/jobfile.test job1: (g=0): rw=randrw, bs=8K-8K/8K-8K, ioengine=sync, iodepth=1 Starting 1 process Run status group 0 (all jobs): Disk stats (read/write): sda: ios=0/0, merge=0/0, ticks=0/0, in_queue=0, util=0.00% jobfile: [global] bs=8k iodepth_batch=1 randrepeat=1 size=100m [job1] ioengine=sync rw=randrw filename=newfile Manually bisected it to commit 509eab12448823a8eefbe925804b5308ee63bf5e Here is the patch which fixed the issue for me. Please review and apply. In case of new file "f->io_size > f->real_file_size" becomes true, since f->real_file_size is 0. Signed-off-by: Jens Axboe --- filesetup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/filesetup.c b/filesetup.c index a3bafca1..a7dff0fc 100644 --- a/filesetup.c +++ b/filesetup.c @@ -403,7 +403,8 @@ int setup_files(struct thread_data *td) * zero, set it to the real file size. */ f->io_size = td->o.size / td->o.nr_files; - if (!f->io_size || f->io_size > f->real_file_size) { + if ((!f->io_size || f->io_size > f->real_file_size) && + f->real_file_size) { if (f->file_offset > f->real_file_size) goto err_offset; f->io_size = f->real_file_size - f->file_offset; -- 2.25.1