From 01387bfea4b07e6a3df636a5e5e9b0f31b016fc1 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Thu, 12 Sep 2019 11:17:08 -0700 Subject: [PATCH] engines/io_uring: Add support for sync_file_range. Previously sync_file_range() requests were just dropped to the floor. Signed-off-by: Andres Freund --- engines/io_uring.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/engines/io_uring.c b/engines/io_uring.c index 65f8e236..93ffb5bd 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -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; -- 2.25.1