pvsync2: Support RWF_ATOMIC
authorAlan Adamson <alan.adamson@oracle.com>
Mon, 16 Sep 2024 16:53:41 +0000 (16:53 +0000)
committerJens Axboe <axboe@kernel.dk>
Mon, 16 Sep 2024 18:15:15 +0000 (12:15 -0600)
Set RWF_ATOMIC for writes and atomic==1.

Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
jpg: Set FIO_ATOMICWRITES for pvsync2
Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240916165347.2226763-4-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/sync.c

index b8be4eb34129edad621f92b0e1b71a856a93a821..729d8a71cfea25f6827a6f70fff469493b473b25 100644 (file)
@@ -175,9 +175,11 @@ static enum fio_q_status fio_pvsyncio2_queue(struct thread_data *td,
 
        if (io_u->ddir == DDIR_READ)
                ret = preadv2(f->fd, iov, 1, io_u->offset, flags);
-       else if (io_u->ddir == DDIR_WRITE)
+       else if (io_u->ddir == DDIR_WRITE) {
+               if (td->o.oatomic)
+                       flags |= RWF_ATOMIC;
                ret = pwritev2(f->fd, iov, 1, io_u->offset, flags);
-       else if (io_u->ddir == DDIR_TRIM) {
+       else if (io_u->ddir == DDIR_TRIM) {
                do_io_u_trim(td, io_u);
                return FIO_Q_COMPLETED;
        } else
@@ -476,7 +478,8 @@ static struct ioengine_ops ioengine_pvrw2 = {
        .open_file      = generic_open_file,
        .close_file     = generic_close_file,
        .get_file_size  = generic_get_file_size,
-       .flags          = FIO_SYNCIO,
+       .flags          = FIO_SYNCIO |
+                         FIO_ATOMICWRITES,
        .options        = options,
        .option_struct_size     = sizeof(struct psyncv2_options),
 };