Merge branch 'enable-dataplacement-scheme' of https://github.com/parkvibes/fio
[fio.git] / iolog.c
diff --git a/iolog.c b/iolog.c
index b4c7a8f13157531be4f4d426ebc9e8a32bf50bcc..96af4f33e186dd4ec1a02b851a1c7ae4c0b1eaeb 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -102,6 +102,8 @@ static void iolog_delay(struct thread_data *td, unsigned long delay)
                ret = io_u_queued_complete(td, 0);
                if (ret < 0)
                        td_verror(td, -ret, "io_u_queued_complete");
+               if (td->flags & TD_F_REGROW_LOGS)
+                       regrow_logs(td);
                if (utime_since_now(&ts) > delay)
                        break;
        }
@@ -812,6 +814,8 @@ bool init_iolog(struct thread_data *td)
        if (!ret)
                td_verror(td, EINVAL, "failed initializing iolog");
 
+       init_disk_util(td);
+
        return ret;
 }
 
@@ -862,7 +866,12 @@ void setup_log(struct io_log **log, struct log_params *p,
                l->log_ddir_mask = LOG_OFFSET_SAMPLE_BIT;
        if (l->log_prio)
                l->log_ddir_mask |= LOG_PRIO_SAMPLE_BIT;
-       if (l->td->o.log_max == IO_LOG_SAMPLE_BOTH)
+       /*
+        * The bandwidth-log option generates agg-read_bw.log,
+        * agg-write_bw.log and agg-trim_bw.log for which l->td is NULL.
+        * Check if l->td is valid before dereferencing it.
+        */
+       if (l->td && l->td->o.log_max == IO_LOG_SAMPLE_BOTH)
                l->log_ddir_mask |= LOG_AVG_MAX_SAMPLE_BIT;
 
        INIT_FLIST_HEAD(&l->chunk_list);