summaryrefslogtreecommitdiff
path: root/debug.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2018-02-12 10:11:31 -0700
committerJens Axboe <axboe@kernel.dk>2018-02-12 10:11:31 -0700
commit5ec3bc5401f354444bdc0ce3c240df664f50d520 (patch)
treebb3b74e50324e422a4a2752f5b6fffda11787edb /debug.h
parentb88beb60738e0ec936b3d0f5a09c315ebb654336 (diff)
downloadfio-5ec3bc5401f354444bdc0ce3c240df664f50d520.tar.gz
fio-5ec3bc5401f354444bdc0ce3c240df664f50d520.tar.bz2
init: add global 'warned' state
In various places we spew a warning if some static variable isn't set, but this still means it can happen once per job. Add some global state to allow to track this globally instead. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'debug.h')
-rw-r--r--debug.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/debug.h b/debug.h
index e3aa3f18..68a5adca 100644
--- a/debug.h
+++ b/debug.h
@@ -2,6 +2,7 @@
#define FIO_DEBUG_H
#include <assert.h>
+#include "lib/types.h"
#include "log.h"
enum {
@@ -26,7 +27,17 @@ enum {
FD_DEBUG_MAX,
};
-extern unsigned int fio_debug_jobno, *fio_debug_jobp;
+extern unsigned int fio_debug_jobno, *fio_debug_jobp, *fio_warned;
+
+static inline bool fio_did_warn(unsigned int mask)
+{
+ if (!(*fio_warned & mask)) {
+ *fio_warned |= mask;
+ return true;
+ }
+
+ return false;
+}
#ifdef FIO_INC_DEBUG
struct debug_level {