engines/libblkio: Add support for poll queues
authorAlberto Faria <afaria@redhat.com>
Thu, 1 Dec 2022 22:07:57 +0000 (22:07 +0000)
committerVincent Fu <vincent.fu@samsung.com>
Fri, 2 Dec 2022 21:24:03 +0000 (16:24 -0500)
Configure a poll queue instead of a "regular" queue when option hipri is
set.

Signed-off-by: Alberto Faria <afaria@redhat.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
HOWTO.rst
engines/libblkio.c
fio.1

index 69ca1e79025c14c0fdb4483232a4244fa89f06af..2b3fe9c23c1e260c23e88f38bb3b0e5f1ee704d2 100644 (file)
--- a/HOWTO.rst
+++ b/HOWTO.rst
@@ -2335,6 +2335,10 @@ with the caveat that when used on the command line, they must come after the
         by the application. The benefits are more efficient IO for high IOPS
         scenarios, and lower latencies for low queue depth IO.
 
+   [libblkio]
+
+       Use poll queues.
+
    [pvsync2]
 
        Set RWF_HIPRI on I/O, indicating to the kernel that it's of higher priority
index 11f45e2a59f17d4382b977d714d284a86d0c4d63..6decfd39e49f8111077fece183068235527ac0f7 100644 (file)
@@ -37,6 +37,8 @@ struct fio_blkio_options {
        char *driver;
        char *pre_connect_props;
        char *pre_start_props;
+
+       unsigned int hipri;
 };
 
 static struct fio_option options[] = {
@@ -67,6 +69,15 @@ static struct fio_option options[] = {
                .category = FIO_OPT_C_ENGINE,
                .group  = FIO_OPT_G_LIBBLKIO,
        },
+       {
+               .name   = "hipri",
+               .lname  = "Use poll queues",
+               .type   = FIO_OPT_STR_SET,
+               .off1   = offsetof(struct fio_blkio_options, hipri),
+               .help   = "Use poll queues",
+               .category = FIO_OPT_C_ENGINE,
+               .group  = FIO_OPT_G_LIBBLKIO,
+       },
        {
                .name = NULL,
        },
@@ -223,6 +234,7 @@ out_blkio_destroy:
 
 static int fio_blkio_init(struct thread_data *td)
 {
+       const struct fio_blkio_options *options = td->eo;
        struct fio_blkio_data *data;
 
        /*
@@ -246,7 +258,13 @@ static int fio_blkio_init(struct thread_data *td)
        if (fio_blkio_create_and_connect(td, &data->b) != 0)
                goto err_free;
 
-       if (blkio_set_int(data->b, "num-queues", 1) != 0) {
+       if (blkio_set_int(data->b, "num-queues", options->hipri ? 0 : 1) != 0) {
+               fio_blkio_log_err(blkio_set_int);
+               goto err_blkio_destroy;
+       }
+
+       if (blkio_set_int(data->b, "num-poll-queues",
+                         options->hipri ? 1 : 0) != 0) {
                fio_blkio_log_err(blkio_set_int);
                goto err_blkio_destroy;
        }
@@ -256,7 +274,10 @@ static int fio_blkio_init(struct thread_data *td)
                goto err_blkio_destroy;
        }
 
-       data->q = blkio_get_queue(data->b, 0);
+       if (options->hipri)
+               data->q = blkio_get_poll_queue(data->b, 0);
+       else
+               data->q = blkio_get_queue(data->b, 0);
 
        /* Set data last so cleanup() does nothing if init() fails. */
        td->io_ops_data = data;
diff --git a/fio.1 b/fio.1
index 18428774025877806fb4756653e3f39c2d46cdb1..7f97e94056641fd54d34b4b79f8669d1df70b8c8 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -2631,6 +2631,9 @@ before starting the libblkio instance. Each property must have the format
 the engine sets any other properties, so those can be overriden. Available
 properties depend on the libblkio version in use and are listed at
 \fIhttps://libblkio.gitlab.io/libblkio/blkio.html#properties\fR
+.TP
+.BI (libblkio)hipri
+Use poll queues.
 .SS "I/O depth"
 .TP
 .BI iodepth \fR=\fPint