From: Jiri Horky Date: Fri, 25 Jul 2014 07:55:03 +0000 (+0200) Subject: Allow reset of offset_increment counter X-Git-Tag: fio-2.1.12~15 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=69bdd6badc47775443413405e1aea4abe9e570c9;ds=sidebyside 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 --- diff --git a/HOWTO b/HOWTO index ac960698..1c4b308c 100644 --- a/HOWTO +++ b/HOWTO @@ -736,11 +736,12 @@ offset=int Start io at the given offset in the file. The data before 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 39c276a3..12a43b1f 100644 --- a/filesetup.c +++ b/filesetup.c @@ -758,7 +758,7 @@ uint64_t get_start_offset(struct thread_data *td, struct fio_file *f) 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 22d6b1e8..52911264 100644 --- a/fio.1 +++ b/fio.1 @@ -657,10 +657,11 @@ Offset in the file to start I/O. Data before the offset will not be touched. .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 c694f2cf..dfbad6d6 100644 --- a/fio.h +++ b/fio.h @@ -102,6 +102,7 @@ struct thread_data { 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 b4a0cbb9..62c7dc24 100644 --- a/init.c +++ b/init.c @@ -380,6 +380,7 @@ static struct thread_data *get_new_job(int global, struct thread_data *parent, profile_add_hooks(td); td->thread_number = thread_number; + td->subjob_number = 0; if (jobname) td->o.name = strdup(jobname); @@ -1288,6 +1289,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, 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) {