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 80a7047ee65179b3a47af37f031543d18b9feb81..6ceefbc10a0fd158e5bbcfd48a825af9851d375a 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 fa015c393ea24bb9ff2be3361b7ba91ac50d16a3..e830884660266cf3fb2471ace132bb20bd9c9e1b 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 *);