From: Vincent Fu <vincentfu@gmail.com>
To: Alberto Faria <afaria@redhat.com>, fio@vger.kernel.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>
Subject: Re: [PATCH 05/10] engines/libblkio: Add option libblkio_vectored
Date: Thu, 1 Dec 2022 12:11:52 -0500 [thread overview]
Message-ID: <2fbfff28-30a4-97bd-fd2b-e48bb8b837d4@gmail.com> (raw)
In-Reply-To: <20221121182902.373491-6-afaria@redhat.com>
On 11/21/22 13:28, Alberto Faria wrote:
> When enabled, read and write requests are submitted as vectored requests
> using blkioq_{readv,writev}(), instead of using blkioq_{read,write}().
>
> Signed-off-by: Alberto Faria <afaria@redhat.com>
> ---
> HOWTO.rst | 4 ++++
> engines/libblkio.c | 46 +++++++++++++++++++++++++++++++++++++++++-----
> fio.1 | 3 +++
> 3 files changed, 48 insertions(+), 5 deletions(-)
>
> diff --git a/HOWTO.rst b/HOWTO.rst
> index cdea3258..b9c7c8df 100644
> --- a/HOWTO.rst
> +++ b/HOWTO.rst
> @@ -2875,6 +2875,10 @@ with the caveat that when used on the command line, they must come after the
> set after the engine sets any other properties, so those can be
> overriden.
>
> +.. option:: libblkio_vectored=bool : [libblkio]
See my response to the hipri patch regarding the difference between
booleans and FIO_OPT_STR_SET. I don't have strong feelings regarding
whether this should be a boolean or FIO_OPT_STR_SET but if the type
listed in the HOWTO and manpage is boolean then the type in the options
struct should be FIO_OPT_BOOL. No type should be listed when it's
FIO_OPT_STR_SET.
> +
> + Submit vectored read and write requests. Default is 0.
> +
> I/O depth
> ~~~~~~~~~
>
> diff --git a/engines/libblkio.c b/engines/libblkio.c
> index d2ade3f1..dcf701ad 100644
> --- a/engines/libblkio.c
> +++ b/engines/libblkio.c
> @@ -28,6 +28,7 @@ struct fio_blkio_options {
> char *pre_start_props;
>
> unsigned int hipri;
> + unsigned int vectored;
> };
>
> static struct fio_option options[] = {
> @@ -68,6 +69,15 @@ static struct fio_option options[] = {
> .category = FIO_OPT_C_ENGINE,
> .group = FIO_OPT_G_LIBBLKIO,
> },
> + {
> + .name = "libblkio_vectored",
> + .lname = "Use blkioq_{readv,writev}()",
> + .type = FIO_OPT_STR_SET,
> + .off1 = offsetof(struct fio_blkio_options, vectored),
> + .help = "Use blkioq_{readv,writev}() instead of blkioq_{read,write}()",
> + .category = FIO_OPT_C_ENGINE,
> + .group = FIO_OPT_G_LIBBLKIO,
> + },
>
> {
> .name = NULL,
> @@ -251,6 +261,7 @@ struct fio_blkio_data {
> bool has_mem_region; /* whether mem_region is valid */
> struct blkio_mem_region mem_region; /* only if allocated by libblkio */
>
> + struct iovec *iovecs; /* for vectored requests */
> struct blkio_completion *completions;
> };
>
> @@ -267,8 +278,9 @@ static int fio_blkio_init(struct thread_data *td)
> goto err_free;
> }
>
> + data->iovecs = calloc(td->o.iodepth, sizeof(data->iovecs[0]));
> data->completions = calloc(td->o.iodepth, sizeof(data->completions[0]));
> - if (!data->completions) {
> + if (!data->iovecs || !data->completions) {
> log_err("fio: calloc() failed\n");
> goto err_free;
> }
> @@ -310,6 +322,7 @@ err_blkio_destroy:
> blkio_destroy(&data->b);
> err_free:
> free(data->completions);
> + free(data->iovecs);
> free(data);
> return 1;
> }
> @@ -362,6 +375,7 @@ static void fio_blkio_cleanup(struct thread_data *td)
> if (data) {
> blkio_destroy(&data->b);
> free(data->completions);
> + free(data->iovecs);
> free(data);
> }
> }
> @@ -432,19 +446,41 @@ static int fio_blkio_open_file(struct thread_data *td, struct fio_file *f)
> static enum fio_q_status fio_blkio_queue(struct thread_data *td,
> struct io_u *io_u)
> {
> + const struct fio_blkio_options *options = td->eo;
> struct fio_blkio_data *data = td->io_ops_data;
>
> fio_ro_check(td, io_u);
>
> switch (io_u->ddir) {
> case DDIR_READ:
> - blkioq_read(data->q, io_u->offset, io_u->xfer_buf,
> - (size_t)io_u->xfer_buflen, io_u, 0);
> + if (options->vectored) {
> + struct iovec *iov = &data->iovecs[io_u->index];
> + iov->iov_base = io_u->xfer_buf;
> + iov->iov_len = (size_t)io_u->xfer_buflen;
> +
> + blkioq_readv(data->q, io_u->offset, iov, 1,
> + io_u, 0);
> + } else {
> + blkioq_read(data->q, io_u->offset,
> + io_u->xfer_buf,
> + (size_t)io_u->xfer_buflen, io_u, 0);
> + }
> break;
>
> case DDIR_WRITE:
> - blkioq_write(data->q, io_u->offset, io_u->xfer_buf,
> - (size_t)io_u->xfer_buflen, io_u, 0);
> + if (options->vectored) {
> + struct iovec *iov = &data->iovecs[io_u->index];
> + iov->iov_base = io_u->xfer_buf;
> + iov->iov_len = (size_t)io_u->xfer_buflen;
> +
> + blkioq_writev(data->q, io_u->offset, iov, 1,
> + io_u, 0);
> + } else {
> + blkioq_write(data->q, io_u->offset,
> + io_u->xfer_buf,
> + (size_t)io_u->xfer_buflen, io_u,
> + 0);
> + }
> break;
>
> case DDIR_TRIM:
> diff --git a/fio.1 b/fio.1
> index 7c1b315a..a403b415 100644
> --- a/fio.1
> +++ b/fio.1
> @@ -2623,6 +2623,9 @@ the engine sets any other properties, so those can be overriden.
> .TP
> .BI (libblkio)hipri \fR=\fPbool
> Use poll queues.
> +.TP
> +.BI (libblkio)libblkio_vectored \fR=\fPbool
> +Submit vectored read and write requests. Default is 0.
> .SS "I/O depth"
> .TP
> .BI iodepth \fR=\fPint
next prev parent reply other threads:[~2022-12-01 17:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-21 18:28 [PATCH 00/10] Add a libblkio engine Alberto Faria
2022-11-21 18:28 ` [PATCH 01/10] " Alberto Faria
2022-11-22 9:17 ` Damien Le Moal
2022-12-01 22:10 ` Alberto Faria
2022-11-21 18:28 ` [PATCH 02/10] Add engine flag FIO_SKIPPABLE_IOMEM_ALLOC Alberto Faria
2022-11-21 18:28 ` [PATCH 03/10] engines/libblkio: Allow setting option mem/iomem Alberto Faria
2022-11-21 18:28 ` [PATCH 04/10] engines/libblkio: Add support for poll queues Alberto Faria
2022-12-01 17:01 ` Vincent Fu
2022-11-21 18:28 ` [PATCH 05/10] engines/libblkio: Add option libblkio_vectored Alberto Faria
2022-12-01 17:11 ` Vincent Fu [this message]
2022-12-01 22:13 ` Alberto Faria
2022-11-21 18:28 ` [PATCH 06/10] engines/libblkio: Add option libblkio_write_zeroes_on_trim Alberto Faria
2022-12-01 17:13 ` Vincent Fu
2022-11-21 18:28 ` [PATCH 07/10] engines/libblkio: Add option libblkio_wait_mode Alberto Faria
2022-12-01 17:21 ` Vincent Fu
2022-11-21 18:29 ` [PATCH 08/10] engines/libblkio: Add option libblkio_force_enable_completion_eventfd Alberto Faria
2022-12-01 17:23 ` Vincent Fu
2022-11-21 18:29 ` [PATCH 09/10] engines/libblkio: Add options for some driver-specific properties Alberto Faria
2022-11-21 18:29 ` [PATCH 10/10] engines/libblkio: Share a single blkio instance among threads in same process Alberto Faria
2022-12-01 17:29 ` Vincent Fu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2fbfff28-30a4-97bd-fd2b-e48bb8b837d4@gmail.com \
--to=vincentfu@gmail.com \
--cc=afaria@redhat.com \
--cc=fio@vger.kernel.org \
--cc=kwolf@redhat.com \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.