Collect and show zone reset statistics
[fio.git] / zbd.c
diff --git a/zbd.c b/zbd.c
index 42487780ca77e5cf7f67665545f47c856bbd2919..f4105b422522ae5ba15cef0bd8d8f020d1d0a6e9 100644 (file)
--- a/zbd.c
+++ b/zbd.c
@@ -594,6 +594,8 @@ static int zbd_reset_range(struct thread_data *td, const struct fio_file *f,
                pthread_mutex_unlock(&z->mutex);
        }
 
+       td->ts.nr_zone_resets += ze - zb;
+
        return ret;
 }
 
@@ -969,3 +971,13 @@ eof:
                pthread_mutex_unlock(&zb->mutex);
        return io_u_eof;
 }
+
+/* Return a string with ZBD statistics */
+char *zbd_write_status(const struct thread_stat *ts)
+{
+       char *res;
+
+       if (asprintf(&res, "; %ld zone resets", ts->nr_zone_resets) < 0)
+               return NULL;
+       return res;
+}