From 2298290eabbe1017421a6ba0f5de93d8c2b048ad Mon Sep 17 00:00:00 2001 From: "ljzhang,Yaxin Hu,Jianchao Tang" Date: Fri, 27 Jul 2007 13:21:28 +0200 Subject: [PATCH] [PATCH] Fix size given larger than filesize given 1. The mission is defined like this: ----------filesize---------------- [global] directory=./temp nrfiles=2 rw=randread filesize=32k size=96k thread [filesize] description="Filesize less than size." ---------------------------------- This job file caused another non-stop thread, which was asked to read 96K but only provided two files of 32K each. The running information kept looking like this: --------------------------------- nonggia@nonggia-desktop:~/fio$ fio --version fio 1.16.9 nonggia@nonggia-desktop:~/fio$ fio filesize filesize: (g=0): rw=randread, bs=4K-4K/4K-4K, ioengine=sync, iodepth=1 Starting 1 thread Jobs: 1 (f=2): [r] [66.7% done] [ 0/ 0 kb/s] [eta 00m:51s] --------------------------------- 2. The reason: After having covered both the two files, the thread still had 32K to issued, while there were already no available files on hand. I agree that it is far from a bug.Maybe it was the job file that we should blame. It was wrong written from the beginning.But why not make it more gentle if we can? 3. Fix suggestion: So what about change it like this? Just limit the max td->o.size with the total_size that all the files can provide. --------------------------------- diff -Nraup fio-7.25/filesetup.c fio-7.25-filesize/filesetup.c --- fio-7.25/filesetup.c 2007-07-25 14:25:05.000000000 +0800 +++ fio-7.25-filesize/filesetup.c 2007-07-27 14:17:39.000000000 +0800 @@ -414,7 +414,7 @@ int setup_files(struct thread_data *td) } } - if (!td->o.size) + if (!td->o.size || td->o.size > total_size) td->o.size = total_size; /* --------------------------------- Now it behaves like this, just finishes as much job as it can and comes to the end: --------------------------------- nonggia@nonggia-desktop:~/fio$ ./filesize_fio filesize filesize: (g=0): rw=randread, bs=4K-4K/4K-4K, ioengine=sync, iodepth=1 Starting 1 thread filesize: (groupid=0, jobs=1): err= 0: pid=8045 Description : ["Filesize less than size."] read : io=64KiB, bw=32768KiB/s, iops=8000, runt= 2msec clat (usec): min= 72, max= 907, avg=167.56, stdev=210.90 cpu : usr=0.00%, sys=0.00%, ctx=1 IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0% issued r/w: total=16/0, short=0/0 lat (usec): 100=62.50%, 250=25.00%, 500=6.25%, 1000=6.25% Run status group 0 (all jobs): READ: io=64KiB, aggrb=32768KiB/s, minb=32768KiB/s, maxb=32768KiB/s, mint=2msec, maxt=2msec Disk stats (read/write): sda: ios=16/0, merge=0/0, ticks=0/0, in_queue=0, util=0.00% nonggia@nonggia-desktop:~/fio$ --------------------------------- Signed-off-by: Jens Axboe --- filesetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filesetup.c b/filesetup.c index b742f825..62240cd0 100644 --- a/filesetup.c +++ b/filesetup.c @@ -414,7 +414,7 @@ int setup_files(struct thread_data *td) } } - if (!td->o.size) + if (!td->o.size || td->o.size > total_size) td->o.size = total_size; /* -- 2.25.1