engines/io_uring: Add support for sync_file_range.
authorAndres Freund <andres@anarazel.de>
Thu, 12 Sep 2019 18:17:08 +0000 (11:17 -0700)
committerAndres Freund <andres@anarazel.de>
Thu, 12 Sep 2019 18:22:47 +0000 (11:22 -0700)
Previously sync_file_range() requests were just dropped to the floor.

Signed-off-by: Andres Freund <andres@anarazel.de>
engines/io_uring.c

index 65f8e23..93ffb5b 100644 (file)
@@ -181,10 +181,17 @@ static int fio_ioring_prep(struct thread_data *td, struct io_u *io_u)
                }
                sqe->off = io_u->offset;
        } else if (ddir_sync(io_u->ddir)) {
-               sqe->fsync_flags = 0;
-               if (io_u->ddir == DDIR_DATASYNC)
-                       sqe->fsync_flags |= IORING_FSYNC_DATASYNC;
-               sqe->opcode = IORING_OP_FSYNC;
+               if (io_u->ddir == DDIR_SYNC_FILE_RANGE) {
+                       sqe->off = f->first_write;
+                       sqe->len = f->last_write - f->first_write;
+                       sqe->sync_range_flags = td->o.sync_file_range;
+                       sqe->opcode = IORING_OP_SYNC_FILE_RANGE;
+               } else {
+                       sqe->fsync_flags = 0;
+                       if (io_u->ddir == DDIR_DATASYNC)
+                               sqe->fsync_flags |= IORING_FSYNC_DATASYNC;
+                       sqe->opcode = IORING_OP_FSYNC;
+               }
        }
 
        sqe->user_data = (unsigned long) io_u;