From a25ba6c64fe1313716f5a593ae6bd67492b2314a Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 17 Feb 2023 11:14:47 -0700 Subject: [PATCH] Get rid of O_ATOMIC This feature never went upstream on the Linux kernel side, let's just get rid of it. The option is left for now, but we can deprecate that or even probably remove it as it will never had had any effect. Signed-off-by: Jens Axboe --- HOWTO.rst | 6 ------ backend.c | 4 ++-- engines/ime.c | 4 ---- engines/libzbc.c | 6 ------ filesetup.c | 7 ------- fio.1 | 5 ----- init.c | 6 ------ memory.c | 4 ++-- os/os-linux.h | 6 ------ os/os.h | 6 ------ 10 files changed, 4 insertions(+), 50 deletions(-) diff --git a/HOWTO.rst b/HOWTO.rst index 158c5d897e..26a3c039a5 100644 --- a/HOWTO.rst +++ b/HOWTO.rst @@ -1110,12 +1110,6 @@ I/O type OpenBSD and ZFS on Solaris don't support direct I/O. On Windows the synchronous ioengines don't support direct I/O. Default: false. -.. option:: atomic=bool - - If value is true, attempt to use atomic direct I/O. Atomic writes are - guaranteed to be stable once acknowledged by the operating system. Only - Linux supports O_ATOMIC right now. - .. option:: buffered=bool If value is true, use buffered I/O. This is the opposite of the diff --git a/backend.c b/backend.c index 0ccc7c2b72..9e981bf408 100644 --- a/backend.c +++ b/backend.c @@ -1333,7 +1333,7 @@ int init_io_u_buffers(struct thread_data *td) * overflow later. this adjustment may be too much if we get * lucky and the allocator gives us an aligned address. */ - if (td->o.odirect || td->o.mem_align || td->o.oatomic || + if (td->o.odirect || td->o.mem_align || td_ioengine_flagged(td, FIO_RAWIO)) td->orig_buffer_size += page_mask + td->o.mem_align; @@ -1352,7 +1352,7 @@ int init_io_u_buffers(struct thread_data *td) if (data_xfer && allocate_io_mem(td)) return 1; - if (td->o.odirect || td->o.mem_align || td->o.oatomic || + if (td->o.odirect || td->o.mem_align || td_ioengine_flagged(td, FIO_RAWIO)) p = PTR_ALIGN(td->orig_buffer, page_mask) + td->o.mem_align; else diff --git a/engines/ime.c b/engines/ime.c index f6690cc16c..037b8419e2 100644 --- a/engines/ime.c +++ b/engines/ime.c @@ -188,10 +188,6 @@ static int fio_ime_open_file(struct thread_data *td, struct fio_file *f) return 1; } - if (td->o.oatomic) { - td_verror(td, EINVAL, "IME does not support atomic IO"); - return 1; - } if (td->o.odirect) flags |= O_DIRECT; flags |= td->o.sync_io; diff --git a/engines/libzbc.c b/engines/libzbc.c index cb3e9ca545..1bf1e8c8d8 100644 --- a/engines/libzbc.c +++ b/engines/libzbc.c @@ -71,12 +71,6 @@ static int libzbc_open_dev(struct thread_data *td, struct fio_file *f, flags |= O_RDONLY; } - if (td->o.oatomic) { - td_verror(td, EINVAL, "libzbc does not support O_ATOMIC"); - log_err("%s: libzbc does not support O_ATOMIC\n", f->file_name); - return -EINVAL; - } - ld = calloc(1, sizeof(*ld)); if (!ld) return -ENOMEM; diff --git a/filesetup.c b/filesetup.c index cb7047c5af..1836d7e2a1 100644 --- a/filesetup.c +++ b/filesetup.c @@ -741,13 +741,6 @@ int generic_open_file(struct thread_data *td, struct fio_file *f) goto skip_flags; if (td->o.odirect) flags |= OS_O_DIRECT; - if (td->o.oatomic) { - if (!FIO_O_ATOMIC) { - td_verror(td, EINVAL, "OS does not support atomic IO"); - return 1; - } - flags |= OS_O_DIRECT | FIO_O_ATOMIC; - } flags |= td->o.sync_io; if (td->o.create_on_open && td->o.allow_create) flags |= O_CREAT; diff --git a/fio.1 b/fio.1 index 00a0935390..9ec90133ae 100644 --- a/fio.1 +++ b/fio.1 @@ -873,11 +873,6 @@ If value is true, use non-buffered I/O. This is usually O_DIRECT. Note that OpenBSD and ZFS on Solaris don't support direct I/O. On Windows the synchronous ioengines don't support direct I/O. Default: false. .TP -.BI atomic \fR=\fPbool -If value is true, attempt to use atomic direct I/O. Atomic writes are -guaranteed to be stable once acknowledged by the operating system. Only -Linux supports O_ATOMIC right now. -.TP .BI buffered \fR=\fPbool If value is true, use buffered I/O. This is the opposite of the \fBdirect\fR option. Defaults to true. diff --git a/init.c b/init.c index f6a8056a2d..78c6c80351 100644 --- a/init.c +++ b/init.c @@ -916,12 +916,6 @@ static int fixup_options(struct thread_data *td) ret |= 1; } - /* - * O_ATOMIC implies O_DIRECT - */ - if (o->oatomic) - o->odirect = 1; - /* * If randseed is set, that overrides randrepeat */ diff --git a/memory.c b/memory.c index 577d3dd5af..2fdca65768 100644 --- a/memory.c +++ b/memory.c @@ -295,7 +295,7 @@ int allocate_io_mem(struct thread_data *td) total_mem = td->orig_buffer_size; - if (td->o.odirect || td->o.mem_align || td->o.oatomic || + if (td->o.odirect || td->o.mem_align || td_ioengine_flagged(td, FIO_MEMALIGN)) { total_mem += page_mask; if (td->o.mem_align && td->o.mem_align > page_size) @@ -341,7 +341,7 @@ void free_io_mem(struct thread_data *td) unsigned int total_mem; total_mem = td->orig_buffer_size; - if (td->o.odirect || td->o.oatomic) + if (td->o.odirect) total_mem += page_mask; if (td->io_ops->iomem_alloc && !fio_option_is_set(&td->o, mem_type)) { diff --git a/os/os-linux.h b/os/os-linux.h index bbb1f27c82..7a78b42d4d 100644 --- a/os/os-linux.h +++ b/os/os-linux.h @@ -205,12 +205,6 @@ static inline unsigned long long os_phys_mem(void) #define FIO_O_NOATIME 0 #endif -#ifdef O_ATOMIC -#define OS_O_ATOMIC O_ATOMIC -#else -#define OS_O_ATOMIC 040000000 -#endif - #ifdef MADV_REMOVE #define FIO_MADV_FREE MADV_REMOVE #endif diff --git a/os/os.h b/os/os.h index c428260ca4..ebaf8af5e2 100644 --- a/os/os.h +++ b/os/os.h @@ -133,12 +133,6 @@ extern int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu); #define OS_O_DIRECT O_DIRECT #endif -#ifdef OS_O_ATOMIC -#define FIO_O_ATOMIC OS_O_ATOMIC -#else -#define FIO_O_ATOMIC 0 -#endif - #ifndef FIO_HAVE_HUGETLB #define SHM_HUGETLB 0 #define MAP_HUGETLB 0