options: add debug code for failure to lookup option names
authorJens Axboe <axboe@fb.com>
Fri, 19 Dec 2014 04:51:21 +0000 (21:51 -0700)
committerJens Axboe <axboe@fb.com>
Fri, 19 Dec 2014 04:51:21 +0000 (21:51 -0700)
Signed-off-by: Jens Axboe <axboe@fb.com>
options.c
options.h

index 80a7047..6ceefbc 100644 (file)
--- a/options.c
+++ b/options.c
@@ -4206,7 +4206,7 @@ int __fio_option_is_set(struct thread_options *o, unsigned int off1)
 
        if (!opt) {
                log_err("fio: no option found at offset %u\n", off1);
-               return 0;
+               return -1;
        }
 
        opt_off = opt - &fio_options[0];
index fa015c3..e830884 100644 (file)
--- a/options.h
+++ b/options.h
@@ -24,8 +24,15 @@ extern struct fio_option fio_options[FIO_MAX_OPTS];
 
 extern int __fio_option_is_set(struct thread_options *, unsigned int off);
 
-#define fio_option_is_set(__td, name)  \
-       __fio_option_is_set((__td), td_var_offset(name))
+#define fio_option_is_set(__td, name)                                  \
+({                                                                     \
+       int __r = __fio_option_is_set((__td), td_var_offset(name));     \
+       if (__r == -1) {                                                \
+               log_err("fio: wanted %s\n", __fio_stringify(name));     \
+               __r = 0;                                                \
+       }                                                               \
+       __r;                                                            \
+})
 
 extern void fio_option_mark_set(struct thread_options *, struct fio_option *);