Re: [PATCH 04/10] engines/libblkio: Add support for poll queues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/21/22 13:28, Alberto Faria wrote:
Configure a poll queue instead of a "regular" queue when option hipri is
set.

Signed-off-by: Alberto Faria <afaria@xxxxxxxxxx>
---
  HOWTO.rst          |  4 ++++
  engines/libblkio.c | 26 ++++++++++++++++++++++++--
  fio.1              |  3 +++
  3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/HOWTO.rst b/HOWTO.rst
index fb27d3d3..cdea3258 100644
--- a/HOWTO.rst
+++ b/HOWTO.rst
@@ -2330,6 +2330,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
diff --git a/engines/libblkio.c b/engines/libblkio.c
index 54fd9ff6..d2ade3f1 100644
--- a/engines/libblkio.c
+++ b/engines/libblkio.c
@@ -26,6 +26,8 @@ struct fio_blkio_options {
  	char *driver;
  	char *pre_connect_props;
  	char *pre_start_props;
+
+	unsigned int hipri;
  };
static struct fio_option options[] = {
@@ -57,6 +59,16 @@ static struct fio_option options[] = {
  		.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,
+	},
+

Some of these elements have blank lines before or after the { } and others do not. For consistency I would eliminate the blank lines before and after the { and }.

  	{
  		.name = NULL,
  	},
@@ -244,6 +256,7 @@ struct fio_blkio_data {
static int fio_blkio_init(struct thread_data *td)
  {
+	const struct fio_blkio_options *options = td->eo;
  	struct fio_blkio_data *data;
/* allocate per-thread data struct */
@@ -265,7 +278,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;
  	}
@@ -277,7 +296,10 @@ static int fio_blkio_init(struct thread_data *td)
/* get queue */ - 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 only here so cleanup() does nothing if init() fails. */
  	td->io_ops_data = data;
diff --git a/fio.1 b/fio.1
index 12eeb013..7c1b315a 100644
--- a/fio.1
+++ b/fio.1
@@ -2620,6 +2620,9 @@ A colon-separated list of libblkio properties to be set after connecting but
  before starting the \fBstruct blkio\fR. Each property must have the format
  \fB<name>=<value>\fR. Colons can be escaped as \fB\\:\fR. These are set after
  the engine sets any other properties, so those can be overriden.
+.TP
+.BI (libblkio)hipri \fR=\fPbool

The type for hipri is FIO_OPT_STR_SET which is different from a boolean. If it were a boolean fio would accept only hipri=0 or hipri=1. For FIO_OPT_STR_SET fio accepts hipri=<any number>, or just hipri with no value (same meaning as hipri=1), with 0 representing false.

For FIO_OPT_STR_SET options (e.g., thread, time_based) the convention in the man page is to not specify a type.



[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux