From: Jens Axboe Date: Tue, 6 Dec 2005 15:54:46 +0000 (+0100) Subject: [PATCH] fio: various little fixes / docu updates X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=2c580c4807f351769e556eaa6450cf9b15c4e739;p=disktools.git [PATCH] fio: various little fixes / docu updates --- diff --git a/README.fio b/README.fio index 4e33af3..66ac18d 100644 --- a/README.fio +++ b/README.fio @@ -58,6 +58,7 @@ The format is as follows: use crc32 for verifies. stonewall Wait for preceeding jobs to end before running. numjobs=x Create 'x' similar entries for this job + thread Use pthreads instead of forked jobs Examples using a job file diff --git a/fio-ini.c b/fio-ini.c index c994003..3fa9d09 100644 --- a/fio-ini.c +++ b/fio-ini.c @@ -160,8 +160,12 @@ static int add_job(struct thread_data *td, const char *jobname, int prioclass, struct stat sb; int numjobs; - if (td == &def_thread) - return 0; + if (td->io_engine & FIO_SYNCIO) + td->iodepth = 1; + else { + if (!td->iodepth) + td->iodepth = 1; + } #ifndef FIO_HAVE_LIBAIO if (td->io_engine == FIO_LIBAIO) { @@ -179,6 +183,12 @@ static int add_job(struct thread_data *td, const char *jobname, int prioclass, td->ioprio = (prioclass << IOPRIO_CLASS_SHIFT) | prio; #endif + /* + * the def_thread is just for options, it's not a real job + */ + if (td == &def_thread) + return 0; + td->filetype = FIO_TYPE_FILE; if (!stat(jobname, &sb) && S_ISBLK(sb.st_mode)) td->filetype = FIO_TYPE_BD; @@ -197,13 +207,6 @@ static int add_job(struct thread_data *td, const char *jobname, int prioclass, td->slat_stat.min_val = ULONG_MAX; td->bw_stat.min_val = ULONG_MAX; - run_str[td->thread_number - 1] = 'P'; - - if ((td->io_engine & FIO_SYNCIO) == 0) { - if (!td->iodepth) - td->iodepth = 1; - } - if (td->min_bs == -1U) td->min_bs = td->bs; if (td->max_bs == -1U) diff --git a/fio-io.c b/fio-io.c index 92a03b0..f663dba 100644 --- a/fio-io.c +++ b/fio-io.c @@ -1,7 +1,15 @@ +/* + * The io parts of the fio tool, includes workers for sync and mmap'ed + * io, as well as both posix and linux libaio support. + * + * sync io is implemented on top of aio. + * + */ #include #include #include #include +#include #include #include "fio.h" #include "os.h" @@ -262,6 +270,12 @@ struct syncio_data { static int fio_syncio_getevents(struct thread_data *td, int min, int max, struct timespec *t) { + assert(max <= 1); + + /* + * we can only have one finished io_u for sync io, since the depth + * is always 1 + */ if (list_empty(&td->io_u_busylist)) return 0; @@ -272,6 +286,8 @@ static struct io_u *fio_syncio_event(struct thread_data *td, int event) { struct syncio_data *sd = td->io_data; + assert(event == 0); + return sd->last_io_u; } diff --git a/fio.c b/fio.c index 7032e8d..546ac98 100644 --- a/fio.c +++ b/fio.c @@ -47,9 +47,10 @@ int groupid = 0; int thread_number = 0; -char run_str[MAX_JOBS + 1]; +static char run_str[MAX_JOBS + 1]; int shm_id = 0; static LIST_HEAD(disk_list); +static struct itimerval itimer; static void update_io_ticks(void); static void disk_util_timer_arm(void); @@ -1546,8 +1547,6 @@ static void init_disk_util(struct thread_data *td) static void disk_util_timer_arm(void) { - struct itimerval itimer; - itimer.it_value.tv_sec = 0; itimer.it_value.tv_usec = DISK_UTIL_MSEC * 1000; setitimer(ITIMER_REAL, &itimer, NULL); @@ -1854,6 +1853,8 @@ static void run_threads(void) for (i = 0; i < thread_number; i++) { td = &threads[i]; + run_str[td->thread_number - 1] = 'P'; + init_disk_util(td); if (!td->create_serialize) @@ -2062,8 +2063,6 @@ static void show_run_stats(void) int main(int argc, char *argv[]) { - memset(run_str, 0, sizeof(run_str)); - if (parse_options(argc, argv)) return 1; diff --git a/fio.h b/fio.h index b71c301..de065cd 100644 --- a/fio.h +++ b/fio.h @@ -225,8 +225,6 @@ extern int thread_number; extern int shm_id; extern int groupid; -extern char run_str[]; - extern struct thread_data *threads; enum {