Re: [PATCH] filesetup: do not ask O_RDWR for read-only workload

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

 



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




[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