Allow reset of offset_increment counter
Reset offset_increment only within a sub-group of jobs, eg when
numjobs=x is used to automatically group jobs together.
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/HOWTO b/HOWTO
index ac96069..1c4b308 100644
--- a/HOWTO
+++ b/HOWTO
@@ -736,11 +736,12 @@
caps the file size at real_size - offset.
offset_increment=int If this is provided, then the real offset becomes
- the offset + offset_increment * thread_number, where the
- thread number is a counter that starts at 0 and is incremented
- for each job. This option is useful if there are several jobs
- which are intended to operate on a file in parallel in disjoint
- segments, with even spacing between the starting points.
+ offset + offset_increment * thread_number, where the thread
+ number is a counter that starts at 0 and is incremented for
+ each sub-job (i.e. when numjobs option is specified). This
+ option is useful if there are several jobs which are intended
+ to operate on a file in parallel disjoint segments, with
+ even spacing between the starting points.
number_ios=int Fio will normally perform IOs until it has exhausted the size
of the region set by size=, or if it exhaust the allocated
diff --git a/filesetup.c b/filesetup.c
index 39c276a..12a43b1 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -758,7 +758,7 @@
return f->real_file_size;
return td->o.start_offset +
- (td->thread_number - 1) * td->o.offset_increment;
+ td->subjob_number * td->o.offset_increment;
}
/*
diff --git a/fio.1 b/fio.1
index 22d6b1e..5291126 100644
--- a/fio.1
+++ b/fio.1
@@ -657,10 +657,11 @@
.TP
.BI offset_increment \fR=\fPint
If this is provided, then the real offset becomes the
-offset + offset_increment * thread_number, where the thread number is a counter
-that starts at 0 and is incremented for each job. This option is useful if
-there are several jobs which are intended to operate on a file in parallel in
-disjoint segments, with even spacing between the starting points.
+offset + offset_increment * thread_number, where the thread number is a
+counter that starts at 0 and is incremented for each sub-job (i.e. when
+numjobs option is specified). This option is useful if there are several jobs
+which are intended to operate on a file in parallel disjoint segments, with
+even spacing between the starting points.
.TP
.BI number_ios \fR=\fPint
Fio will normally perform IOs until it has exhausted the size of the region
diff --git a/fio.h b/fio.h
index c694f2c..dfbad6d 100644
--- a/fio.h
+++ b/fio.h
@@ -102,6 +102,7 @@
char verror[FIO_VERROR_SIZE];
pthread_t thread;
unsigned int thread_number;
+ unsigned int subjob_number;
unsigned int groupid;
struct thread_stat ts;
diff --git a/init.c b/init.c
index b4a0cbb..62c7dc2 100644
--- a/init.c
+++ b/init.c
@@ -380,6 +380,7 @@
profile_add_hooks(td);
td->thread_number = thread_number;
+ td->subjob_number = 0;
if (jobname)
td->o.name = strdup(jobname);
@@ -1288,6 +1289,7 @@
td_new->o.numjobs = 1;
td_new->o.stonewall = 0;
td_new->o.new_group = 0;
+ td_new->subjob_number = numjobs;
if (file_alloced) {
if (td_new->files) {