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 06/10] engines/libblkio: Add option libblkio_write_zeroes_on_trim
Date: Thu, 1 Dec 2022 12:13:32 -0500 [thread overview]
Message-ID: <e0d9ba14-ae7f-86a8-a3b3-5b2948f6a304@gmail.com> (raw)
In-Reply-To: <20221121182902.373491-7-afaria@redhat.com>
On 11/21/22 13:28, Alberto Faria wrote:
> When set, trim IOs will be submitted as blkioq_write_zeroes() requests
> instead of blkioq_discard() requests.
>
> Signed-off-by: Alberto Faria <afaria@redhat.com>
> ---
> HOWTO.rst | 5 +++++
> engines/libblkio.c | 20 ++++++++++++++++++--
> fio.1 | 4 ++++
> 3 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/HOWTO.rst b/HOWTO.rst
> index b9c7c8df..7155add6 100644
> --- a/HOWTO.rst
> +++ b/HOWTO.rst
> @@ -2879,6 +2879,11 @@ with the caveat that when used on the command line, they must come after the
>
> Submit vectored read and write requests. Default is 0.
>
> +.. option:: libblkio_write_zeroes_on_trim=bool : [libblkio]
Same comment here as for libblkio_vectored regarding option types.
> +
> + Submit trims as "write zeroes" requests instead of discard requests.
> + Default is 0.
> +
> I/O depth
> ~~~~~~~~~
>
> diff --git a/engines/libblkio.c b/engines/libblkio.c
> index dcf701ad..79af3aa7 100644
> --- a/engines/libblkio.c
> +++ b/engines/libblkio.c
> @@ -29,6 +29,7 @@ struct fio_blkio_options {
>
> unsigned int hipri;
> unsigned int vectored;
> + unsigned int write_zeroes_on_trim;
> };
>
> static struct fio_option options[] = {
> @@ -78,6 +79,16 @@ static struct fio_option options[] = {
> .category = FIO_OPT_C_ENGINE,
> .group = FIO_OPT_G_LIBBLKIO,
> },
> + {
> + .name = "libblkio_write_zeroes_on_trim",
> + .lname = "Use blkioq_write_zeroes() for TRIM",
> + .type = FIO_OPT_STR_SET,
> + .off1 = offsetof(struct fio_blkio_options,
> + write_zeroes_on_trim),
> + .help = "Use blkioq_write_zeroes() for TRIM instead of blkioq_discard()",
> + .category = FIO_OPT_C_ENGINE,
> + .group = FIO_OPT_G_LIBBLKIO,
> + },
>
> {
> .name = NULL,
> @@ -484,8 +495,13 @@ static enum fio_q_status fio_blkio_queue(struct thread_data *td,
> break;
>
> case DDIR_TRIM:
> - blkioq_discard(data->q, io_u->offset, io_u->xfer_buflen,
> - io_u, 0);
> + if (options->write_zeroes_on_trim) {
> + blkioq_write_zeroes(data->q, io_u->offset,
> + io_u->xfer_buflen, io_u, 0);
> + } else {
> + blkioq_discard(data->q, io_u->offset,
> + io_u->xfer_buflen, io_u, 0);
> + }
> break;
>
> case DDIR_SYNC:
> diff --git a/fio.1 b/fio.1
> index a403b415..053c2eda 100644
> --- a/fio.1
> +++ b/fio.1
> @@ -2626,6 +2626,10 @@ Use poll queues.
> .TP
> .BI (libblkio)libblkio_vectored \fR=\fPbool
> Submit vectored read and write requests. Default is 0.
> +.TP
> +.BI (libblkio)libblkio_write_zeroes_on_trim \fR=\fPbool
> +Submit trims as "write zeroes" requests instead of discard requests. Default is
> +0.
> .SS "I/O depth"
> .TP
> .BI iodepth \fR=\fPint
next prev parent reply other threads:[~2022-12-01 17:13 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
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 [this message]
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=e0d9ba14-ae7f-86a8-a3b3-5b2948f6a304@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).