Skip to content

Commit

Permalink
Get rid of O_ATOMIC
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
axboe committed Feb 17, 2023
1 parent dd6500e commit a25ba6c
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 50 deletions.
6 changes: 0 additions & 6 deletions HOWTO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions engines/ime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 0 additions & 6 deletions engines/libzbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 0 additions & 7 deletions filesetup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions fio.1
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 0 additions & 6 deletions init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
4 changes: 2 additions & 2 deletions memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)) {
Expand Down
6 changes: 0 additions & 6 deletions os/os-linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions os/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a25ba6c

Please sign in to comment.