[PATCH] Improve io logging
write_iolog was broken. Change iolog= to read_iolog= to keep things
nicely seperated.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/HOWTO b/HOWTO
index fd9468c..227bc51 100644
--- a/HOWTO
+++ b/HOWTO
@@ -369,9 +369,10 @@
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 538fc86..4ba12c6 100644
--- a/engines/fio-engine-cpu.c
+++ b/engines/fio-engine-cpu.c
@@ -14,7 +14,6 @@
} 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 8571e65..234822e 100644
--- a/fio.c
+++ b/fio.c
@@ -686,7 +686,7 @@
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 046171a..d8b0152 100644
--- a/fio.h
+++ b/fio.h
@@ -222,13 +222,13 @@
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 4ce2cc4..f27fdf1 100644
--- a/init.c
+++ b/init.c
@@ -103,13 +103,13 @@
},
{
.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 @@
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 45e8bb8..2605ece 100644
--- a/io_u.c
+++ b/io_u.c
@@ -211,7 +211,7 @@
/*
* 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 17a4cdf..1343556 100644
--- a/log.c
+++ b/log.c
@@ -93,7 +93,7 @@
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_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 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;