Flexible I/O Tester development
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Vincent Fu <vincentfu@gmail.com>, Kanchan Joshi <joshi.k@samsung.com>
Cc: fio@vger.kernel.org, vincent.fu@samsung.com
Subject: Re: [PATCH] filesetup: do not ask O_RDWR for read-only workload
Date: Fri, 3 Feb 2023 08:32:55 -0700	[thread overview]
Message-ID: <beb7543b-bd4a-3c7c-35f9-2d6e2d6eebcd@kernel.dk> (raw)
In-Reply-To: <c7ae8aa4-7c91-f892-b7fa-0d34ab4ea536@gmail.com>

On 2/3/23 8:26?AM, Vincent Fu wrote:
> diff --git a/engines/sg.c b/engines/sg.c
> index 24783374..0bb5be4a 100644
> --- a/engines/sg.c
> +++ b/engines/sg.c
> @@ -1428,7 +1428,7 @@ static struct ioengine_ops ioengine = {
>      .open_file    = fio_sgio_open,
>      .close_file    = fio_sgio_close,
>      .get_file_size    = fio_sgio_get_file_size,
> -    .flags        = FIO_SYNCIO | FIO_RAWIO,
> +    .flags        = FIO_SYNCIO | FIO_RAWIO | FIO_RO_NEEDS_RW_OPEN,
>      .options    = options,
>      .option_struct_size    = sizeof(struct sg_options)
>  };
> diff --git a/filesetup.c b/filesetup.c
> index 1d3cc5ad..cb7047c5 100644
> --- a/filesetup.c
> +++ b/filesetup.c
> @@ -768,7 +768,7 @@ open_again:
>          else
>              from_hash = file_lookup_open(f, flags);
>      } else if (td_read(td)) {
> -        if (f->filetype == FIO_TYPE_CHAR && !read_only)
> +        if (td_ioengine_flagged(td, FIO_RO_NEEDS_RW_OPEN) && !read_only)
>              flags |= O_RDWR;
>          else
>              flags |= O_RDONLY;
> diff --git a/ioengines.h b/ioengines.h
> index d43540d0..2cb9743e 100644
> --- a/ioengines.h
> +++ b/ioengines.h
> @@ -89,6 +89,8 @@ enum fio_ioengine_flags {
>              = 1 << 16,    /* async ioengine with commit function that sets issue_time */
>      FIO_SKIPPABLE_IOMEM_ALLOC
>              = 1 << 17,    /* skip iomem_alloc & iomem_free if job sets mem/iomem */
> +    FIO_RO_NEEDS_RW_OPEN
> +            = 1 << 18,    /* open files in rw mode even if we have a read job */
>  };
> 
>  /*

Looks good to me.

-- 
Jens Axboe


  reply	other threads:[~2023-02-03 15:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230203123513epcas5p4cb1961d7d1376bf39690f82de639d6f4@epcas5p4.samsung.com>
2023-02-03 12:34 ` [PATCH] filesetup: do not ask O_RDWR for read-only workload Kanchan Joshi
2023-02-03 12:46   ` Jens Axboe
2023-02-03 14:08     ` Vincent Fu
2023-02-03 14:14       ` Jens Axboe
2023-02-03 15:26         ` Vincent Fu
2023-02-03 15:32           ` Jens Axboe [this message]
2023-02-06  6:52           ` Kanchan Joshi
2023-02-06 19:37             ` Jens Axboe
2023-02-07 16:16               ` Vincent Fu
2023-02-07 16:33                 ` Jens Axboe

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=beb7543b-bd4a-3c7c-35f9-2d6e2d6eebcd@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=joshi.k@samsung.com \
    --cc=vincent.fu@samsung.com \
    --cc=vincentfu@gmail.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