Make sure we handle multiple arguments to sync_file_range
authorJens Axboe <jens.axboe@oracle.com>
Tue, 9 Mar 2010 19:41:15 +0000 (20:41 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 9 Mar 2010 19:41:15 +0000 (20:41 +0100)
We need to be able to OR the values.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
ioengines.c
options.c

index 0e8953404f7e4339572f44aad104f58b2c1a052e..de9349719c21e98d8b1a6dd57c7633dc46ed127b 100644 (file)
@@ -439,8 +439,8 @@ int do_sync_file_range(struct thread_data *td, struct fio_file *f)
        offset = f->first_write;
        nbytes = f->last_write - f->first_write;
 
-       if (nbytes)
-               return sync_file_range(f->fd, offset, nbytes, 0);
+       if (!nbytes)
+               return 0;
 
-       return 0;
+       return sync_file_range(f->fd, offset, nbytes, td->o.sync_file_range);
 }
index bee15cf9586af5bf9eeb9171a2606c765356bec4..dda7cba1bdf16b17f6ea009b722ce8ed79ecc38c 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1131,18 +1131,21 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                          { .ival = "wait_before",
                            .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
                            .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
+                           .or   = 1,
                          },
                          { .ival = "write",
                            .oval = SYNC_FILE_RANGE_WRITE,
                            .help = "SYNC_FILE_RANGE_WRITE",
+                           .or   = 1,
                          },
                          {
                            .ival = "wait_after",
                            .oval = SYNC_FILE_RANGE_WAIT_AFTER,
                            .help = "SYNC_FILE_RANGE_WAIT_AFTER",
+                           .or   = 1,
                          },
                },
-               .type   = FIO_OPT_STR,
+               .type   = FIO_OPT_STR_MULTI,
                .cb     = str_sfr_cb,
                .off1   = td_var_offset(sync_file_range),
                .help   = "Use sync_file_range()",