Re: size/filesize - or how to initiate a looong run

From: Jens Axboe <jens.axboe_at_oracle.com>
Date: Thu, 24 May 2007 10:31:25 +0200

On Thu, May 24 2007, Jens Axboe wrote:
> On Thu, May 24 2007, peter wrote:
> > Hello,
> >
> > When using the following job:
> >
> > [global]
> > filesize=128m
> > size=128g
> >
> > [job1]
> > rw=rw
> > verify=md5
> > randrepeat=1
> > fadvise_hint=0
> > directory=/var/tmp
> > nrfiles=10
> > file_service_type=random
> >
> > I thought that fio would do a total of 128GB of I/O scattered over 10
> > files of 128MB each. However, it seems to only do 128*10 = 1280MB of
> > I/O. The documentation is a little vague in this area. It often uses the
> > word "may", which makes the real intention of size a little vague as well.
>
> I agree, and if you find such weak spots in the documentation, please do
> point them out to me so I can fix them!
>
> The above doesn't have any real meaning right now, you would need to
> specify a number of loops to reach the 128g. But I think it should work
> as you expected it to, it seems the most logical way to handle it. I'll
> take a look at fixing that up.

This patch should fix that up, I've committed it. Your job file above
would then run until 128gb of IO has been done.

diff --git a/fio.c b/fio.c
index 9e93159..fcf3ae8 100644
--- a/fio.c
+++ b/fio.c
@@ -721,6 +721,24 @@ static int switch_ioscheduler(struct thread_data *td)
         return 0;
 }
 
+static int keep_running(struct thread_data *td)
+{
+ unsigned long long io_done;
+
+ if (td->o.time_based)
+ return 1;
+ if (td->o.loops) {
+ td->o.loops--;
+ return 1;
+ }
+
+ io_done = td->io_bytes[DDIR_READ] + td->io_bytes[DDIR_WRITE];
+ if (io_done < td->o.size)
+ return 1;
+
+ return 0;
+}
+
 static int clear_io_state(struct thread_data *td)
 {
         struct fio_file *f;
@@ -838,7 +856,7 @@ static void *thread_main(void *data)
 
         runtime[0] = runtime[1] = 0;
         clear_state = 0;
- while (td->o.time_based || td->o.loops--) {
+ while (keep_running(td)) {
                 fio_gettime(&td->start, NULL);
                 memcpy(&td->ts.stat_sample_time, &td->start, sizeof(td->start));
 

-- 
Jens Axboe
Received on Thu May 24 2007 - 10:31:25 CEST

This archive was generated by hypermail 2.2.0 : Thu May 24 2007 - 11:00:04 CEST