options: warn if we fail to make sense of buffer_pattern
authorJens Axboe <axboe@fb.com>
Fri, 22 Aug 2014 15:22:03 +0000 (10:22 -0500)
committerJens Axboe <axboe@fb.com>
Fri, 22 Aug 2014 15:22:03 +0000 (10:22 -0500)
Signed-off-by: Jens Axboe <axboe@fb.com>
options.c

index 3acfdc86f197a0db37df2e91a3feae477ba25d91..5f4a8ec2923040ed35c89aaecacb906867cda47d 100644 (file)
--- a/options.c
+++ b/options.c
@@ -985,8 +985,8 @@ static int pattern_cb(char *pattern, unsigned int max_size,
 
        if (i == 1) {
                /*
 
        if (i == 1) {
                /*
-                * The code in verify_io_u_pattern assumes a single byte pattern
-                * fills the whole verify pattern buffer.
+                * The code in verify_io_u_pattern assumes a single byte
+                * pattern fills the whole verify pattern buffer.
                 */
                memset(pattern, pattern[0], max_size);
        }
                 */
                memset(pattern, pattern[0], max_size);
        }
@@ -1003,10 +1003,13 @@ static int str_buffer_pattern_cb(void *data, const char *input)
        ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
                                &td->o.buffer_pattern_bytes);
 
        ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
                                &td->o.buffer_pattern_bytes);
 
-       if (!ret) {
+       if (!ret && td->o.buffer_pattern_bytes) {
                td->o.refill_buffers = 0;
                td->o.scramble_buffers = 0;
                td->o.zero_buffers = 0;
                td->o.refill_buffers = 0;
                td->o.scramble_buffers = 0;
                td->o.zero_buffers = 0;
+       } else {
+               log_err("fio: failed parsing pattern `%s`\n", input);
+               ret = 1;
        }
 
        return ret;
        }
 
        return ret;