The following changes since commit 6a16e9e9531a5f746c4e2fe43873de1db434b4fc: diskutil: include limits.h for PATH_MAX (2022-02-15 17:17:30 -0700) are available in the Git repository at: git://git.kernel.dk/fio.git master for you to fetch changes up to c99c81adb3510a8dc34d47fd40b19ef657e32192: Correct F_FULLSYNC -> F_FULLFSYNC (2022-02-17 12:53:59 -0700) ---------------------------------------------------------------- Jens Axboe (4): t/io_uring: allow non-power-of-2 queue depths t/io_uring: align buffers correctly on non-4k page sizes Use fcntl(..., F_FULLSYNC) if available Correct F_FULLSYNC -> F_FULLFSYNC configure | 22 ++++++++++++++++++++++ io_u.c | 4 ++++ t/io_uring.c | 15 ++++++++++----- 3 files changed, 36 insertions(+), 5 deletions(-) --- Diff of recent changes: diff --git a/configure b/configure index 0efde7d6..6160d84d 100755 --- a/configure +++ b/configure @@ -645,6 +645,25 @@ if compile_prog "" "-lz" "zlib" ; then fi print_config "zlib" "$zlib" +########################################## +# fcntl(F_FULLFSYNC) support +if test "$fcntl_sync" != "yes" ; then + fcntl_sync="no" +fi +cat > $TMPC << EOF +#include <unistd.h> +#include <fcntl.h> + +int main(int argc, char **argv) +{ + return fcntl(0, F_FULLFSYNC); +} +EOF +if compile_prog "" "" "fcntl(F_FULLFSYNC)" ; then + fcntl_sync="yes" +fi +print_config "fcntl(F_FULLFSYNC)" "$fcntl_sync" + ########################################## # linux-aio probe if test "$libaio" != "yes" ; then @@ -3174,6 +3193,9 @@ fi if test "$pdb" = yes; then output_sym "CONFIG_PDB" fi +if test "$fcntl_sync" = "yes" ; then + output_sym "CONFIG_FCNTL_SYNC" +fi print_config "Lib-based ioengines dynamic" "$dynamic_engines" cat > $TMPC << EOF diff --git a/io_u.c b/io_u.c index 059637e5..806ceb77 100644 --- a/io_u.c +++ b/io_u.c @@ -2297,7 +2297,11 @@ int do_io_u_sync(const struct thread_data *td, struct io_u *io_u) int ret; if (io_u->ddir == DDIR_SYNC) { +#ifdef CONFIG_FCNTL_SYNC + ret = fcntl(io_u->file->fd, F_FULLFSYNC); +#else ret = fsync(io_u->file->fd); +#endif } else if (io_u->ddir == DDIR_DATASYNC) { #ifdef CONFIG_FDATASYNC ret = fdatasync(io_u->file->fd); diff --git a/t/io_uring.c b/t/io_uring.c index 4520de43..f513d7dc 100644 --- a/t/io_uring.c +++ b/t/io_uring.c @@ -364,7 +364,7 @@ static int io_uring_register_buffers(struct submitter *s) return 0; return syscall(__NR_io_uring_register, s->ring_fd, - IORING_REGISTER_BUFFERS, s->iovecs, depth); + IORING_REGISTER_BUFFERS, s->iovecs, roundup_pow2(depth)); } static int io_uring_register_files(struct submitter *s) @@ -962,7 +962,7 @@ static int setup_aio(struct submitter *s) fixedbufs = register_files = 0; } - return io_queue_init(depth, &s->aio_ctx); + return io_queue_init(roundup_pow2(depth), &s->aio_ctx); #else fprintf(stderr, "Legacy AIO not available on this system/build\n"); errno = EINVAL; @@ -1156,6 +1156,7 @@ int main(int argc, char *argv[]) struct submitter *s; unsigned long done, calls, reap; int err, i, j, flags, fd, opt, threads_per_f, threads_rem = 0, nfiles; + long page_size; struct file f; char *fdepths; void *ret; @@ -1249,7 +1250,7 @@ int main(int argc, char *argv[]) dma_map = 0; submitter = calloc(nthreads, sizeof(*submitter) + - depth * sizeof(struct iovec)); + roundup_pow2(depth) * sizeof(struct iovec)); for (j = 0; j < nthreads; j++) { s = get_submitter(j); s->index = j; @@ -1319,12 +1320,16 @@ int main(int argc, char *argv[]) arm_sig_int(); + page_size = sysconf(_SC_PAGESIZE); + if (page_size < 0) + page_size = 4096; + for (j = 0; j < nthreads; j++) { s = get_submitter(j); - for (i = 0; i < depth; i++) { + for (i = 0; i < roundup_pow2(depth); i++) { void *buf; - if (posix_memalign(&buf, bs, bs)) { + if (posix_memalign(&buf, page_size, bs)) { printf("failed alloc\n"); return 1; }