From: Jens Axboe Date: Fri, 27 Oct 2006 09:24:25 +0000 (+0200) Subject: [PATCH] Improve io logging X-Git-Tag: fio-1.8~33 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=076efc7c60c351df783960a646e7fe8fba29dc19 [PATCH] Improve io logging write_iolog was broken. Change iolog= to read_iolog= to keep things nicely seperated. Signed-off-by: Jens Axboe --- diff --git a/HOWTO b/HOWTO index fd9468c7..227bc513 100644 --- a/HOWTO +++ b/HOWTO @@ -369,9 +369,10 @@ zoneskip=siint Skip the specified number of bytes when zonesize data has been read. The two zone options can be used to only do io on zones of a file. -write_iolog=str Write the issued io patterns to the specified file. See iolog. +write_iolog=str Write the issued io patterns to the specified file. See + read_iolog. -iolog=str Open an iolog with the specified file name and replay the +read_iolog=str Open an iolog with the specified file name and replay the io patterns it contains. This can be used to store a workload and replay it sometime later. diff --git a/engines/fio-engine-cpu.c b/engines/fio-engine-cpu.c index 538fc861..4ba12c64 100644 --- a/engines/fio-engine-cpu.c +++ b/engines/fio-engine-cpu.c @@ -14,7 +14,6 @@ static int fio_cpuio_init(struct thread_data *td) } else if (td->cpuload > 100) td->cpuload = 100; - td->read_iolog = td->write_iolog = 0; td->nr_files = 0; return 0; diff --git a/fio.c b/fio.c index 8571e65b..234822ee 100644 --- a/fio.c +++ b/fio.c @@ -686,7 +686,7 @@ static void *thread_main(void *data) finish_log(td, td->slat_log, "slat"); if (td->clat_log) finish_log(td, td->clat_log, "clat"); - if (td->write_iolog) + if (td->write_iolog_file) write_iolog_close(td); if (td->exec_postrun) system(td->exec_postrun); diff --git a/fio.h b/fio.h index 046171ae..d8b01527 100644 --- a/fio.h +++ b/fio.h @@ -222,13 +222,13 @@ struct thread_data { os_cpu_mask_t cpumask; unsigned int iolog; unsigned int read_iolog; - unsigned int write_iolog; unsigned int rwmixcycle; unsigned int rwmixread; unsigned int rwmixwrite; unsigned int nice; - char *iolog_file; + char *read_iolog_file; + char *write_iolog_file; void *iolog_buf; FILE *iolog_f; diff --git a/init.c b/init.c index 4ce2cc4b..f27fdf1f 100644 --- a/init.c +++ b/init.c @@ -103,13 +103,13 @@ static struct fio_option options[] = { }, { .name = "write_iolog", - .type = FIO_OPT_INT, - .off1 = td_var_offset(write_iolog), + .type = FIO_OPT_STR_STORE, + .off1 = td_var_offset(write_iolog_file), }, { - .name = "iolog", + .name = "read_iolog", .type = FIO_OPT_STR_STORE, - .off1 = td_var_offset(iolog), + .off1 = td_var_offset(read_iolog_file), }, { .name = "exec_prerun", @@ -405,8 +405,11 @@ static void fixup_options(struct thread_data *td) if (!td->rwmixread && td->rwmixwrite) td->rwmixread = 100 - td->rwmixwrite; - if (td->iolog && !td->write_iolog) - td->read_iolog = 1; + if (td->write_iolog_file && td->read_iolog_file) { + log_err("fio: read iolog overrides write_iolog\n"); + free(td->write_iolog_file); + td->write_iolog_file = NULL; + } } /* diff --git a/io_u.c b/io_u.c index 45e8bb81..2605ece9 100644 --- a/io_u.c +++ b/io_u.c @@ -211,7 +211,7 @@ static int fill_io_u(struct thread_data *td, struct fio_file *f, /* * If using a write iolog, store this entry. */ - if (td->write_iolog) + if (td->write_iolog_file) write_iolog_put(td, io_u); io_u->file = f; diff --git a/log.c b/log.c index 17a4cdf7..13435560 100644 --- a/log.c +++ b/log.c @@ -93,7 +93,7 @@ static int init_iolog_read(struct thread_data *td) FILE *f; int rw, reads, writes; - f = fopen(td->iolog_file, "r"); + f = fopen(td->read_iolog_file, "r"); if (!f) { perror("fopen read iolog"); return 1; @@ -151,9 +151,9 @@ static int init_iolog_read(struct thread_data *td) */ static int init_iolog_write(struct thread_data *td) { - FILE *f = fopen(td->iolog_file, "w"); + FILE *f; - f = fopen(td->iolog_file, "w"); + f = fopen(td->write_iolog_file, "w+"); if (!f) { perror("fopen write iolog"); return 1; @@ -172,9 +172,9 @@ int init_iolog(struct thread_data *td) { int ret = 0; - if (td->read_iolog) + if (td->read_iolog_file) ret = init_iolog_read(td); - else if (td->write_iolog) + else if (td->write_iolog_file) ret = init_iolog_write(td); return 0;