blktrace: just ignore zero byte traces
authorJens Axboe <axboe@kernel.dk>
Wed, 4 Jul 2018 20:59:18 +0000 (14:59 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 4 Jul 2018 20:59:18 +0000 (14:59 -0600)
Apparently they do happen. Log a warning (once) and just discard
them.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
blktrace.c
debug.h

index cda111a3a391c0ce2325a22576938cfb2d9f5c41..36a7180930d0f23bf036922820a7901f165a15c9 100644 (file)
@@ -303,6 +303,11 @@ static void handle_trace_discard(struct thread_data *td,
        queue_io_piece(td, ipo);
 }
 
+static void dump_trace(struct blk_io_trace *t)
+{
+       log_err("blktrace: ignoring zero byte trace: action=%x\n", t->action);
+}
+
 static void handle_trace_fs(struct thread_data *td, struct blk_io_trace *t,
                            unsigned long long ttime, unsigned long *ios,
                            unsigned int *rw_bs)
@@ -323,7 +328,11 @@ static void handle_trace_fs(struct thread_data *td, struct blk_io_trace *t,
                        return;
        }
 
-       assert(t->bytes);
+       if (!t->bytes) {
+               if (!fio_did_warn(FIO_WARN_BTRACE_ZERO))
+                       dump_trace(t);
+               return;
+       }
 
        if (t->bytes > rw_bs[rw])
                rw_bs[rw] = t->bytes;
diff --git a/debug.h b/debug.h
index 8a8cf8710e04fd70365925b90ec4cf6081ddecae..e5e8040049ac3a25a53aa19e18f2684d3d6a11ae 100644 (file)
--- a/debug.h
+++ b/debug.h
@@ -42,6 +42,7 @@ enum {
        FIO_WARN_ZONED_BUG      = 4,
        FIO_WARN_IOLOG_DROP     = 8,
        FIO_WARN_FADVISE        = 16,
+       FIO_WARN_BTRACE_ZERO    = 32,
 };
 
 #ifdef FIO_INC_DEBUG