summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b88beb6)
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>
#define FIO_DEBUG_H
#include <assert.h>
#define FIO_DEBUG_H
#include <assert.h>
-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 {
#ifdef FIO_INC_DEBUG
struct debug_level {
unsigned long fio_debug = 0;
unsigned int fio_debug_jobno = -1;
unsigned int *fio_debug_jobp = NULL;
unsigned long fio_debug = 0;
unsigned int fio_debug_jobno = -1;
unsigned int *fio_debug_jobp = NULL;
+unsigned int *fio_warned = NULL;
static char cmd_optstr[256];
static bool did_arg;
static char cmd_optstr[256];
static bool did_arg;
if (threads) {
flow_exit();
fio_debug_jobp = NULL;
if (threads) {
flow_exit();
fio_debug_jobp = NULL;
do {
size_t size = max_jobs * sizeof(struct thread_data);
do {
size_t size = max_jobs * sizeof(struct thread_data);
- size += sizeof(unsigned int);
+ size += 2 * sizeof(unsigned int);
#ifndef CONFIG_NO_SHM
shm_id = shmget(0, size, IPC_CREAT | 0600);
#ifndef CONFIG_NO_SHM
shm_id = shmget(0, size, IPC_CREAT | 0600);
memset(threads, 0, max_jobs * sizeof(struct thread_data));
fio_debug_jobp = (unsigned int *)(threads + max_jobs);
*fio_debug_jobp = -1;
memset(threads, 0, max_jobs * sizeof(struct thread_data));
fio_debug_jobp = (unsigned int *)(threads + max_jobs);
*fio_debug_jobp = -1;
+ fio_warned = fio_debug_jobp + 1;
+ *fio_warned = 0;