[PATCH] Improve io logging
authorJens Axboe <jens.axboe@oracle.com>
Fri, 27 Oct 2006 09:24:25 +0000 (11:24 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 27 Oct 2006 09:24:25 +0000 (11:24 +0200)
write_iolog was broken. Change iolog= to read_iolog= to keep things
nicely seperated.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
HOWTO
engines/fio-engine-cpu.c
fio.c
fio.h
init.c
io_u.c
log.c

diff --git a/HOWTO b/HOWTO
index fd9468c7b6a1faac4b9b4935702ec19b0a8870c3..227bc5133866e0e64bcf408e4ec5e01695e367d9 100644 (file)
--- 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.
 
index 538fc86102cd292e0045bbe7a02a70b677d8a72c..4ba12c64563f3b7bc3bd47ab8cb3a571d8b4f079 100644 (file)
@@ -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 8571e65bba99dc4e2e775d00a74161dfcf419748..234822ee8ecfe9cc7099417af563cbd3aee92277 100644 (file)
--- 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 046171ae03c032243c19906ff8ce3e3afcba52c3..d8b01527e5af2248f68cc78938f951b0d9b9aa41 100644 (file)
--- 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 4ce2cc4bf973dfd728e70f3c5c34159063255ff9..f27fdf1f03f5bfeb9a85aa690670d1cd2e2d2fda 100644 (file)
--- 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 45e8bb81ccc6e4dcfd7bbab57c781824c2d63161..2605ece98b32025a754f52ca301522dc62d0fc68 100644 (file)
--- 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 17a4cdf782c9b02c7c897454abcae6bf66dec34e..134355603cb14e417344d5b4058b8a9ee14874cf 100644 (file)
--- 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;