Commit 3e3577a0 authored by Krzysztof Goreczny's avatar Krzysztof Goreczny Committed by Jim Harris
Browse files

bdev_aio: add support for libaio versions older than 0.3.111

Before version 0.3.111 of libaio field aio_rw_flags in struct iocb
defined in libaio.h didn't exist, was defined just as __pad2. See
https://pagure.io/libaio/c/a6f40



Some distros still use old libaio, SUSE Linux Enterprise Server being
one of them with just released 15.7 version having general support
till Jul 2031.

Add simple check at the configure stage to see if libaio.h defines one
of the function introduced in the 0.3.111 version, similar way as fio
project does in their configure script.

With this fix SPDK can be compiled and used on SLES without any
out-of-distribution OS packages.

Change-Id: Ia1c3ccfb77ad696e2948dd7193ebc51070d237f1
Signed-off-by: default avatarKrzysztof Goreczny <krzysztof.goreczny@dell.com>
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/26374


Reviewed-by: default avatarBoris Glimcher <Boris.Glimcher@emc.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarKonrad Sztyber <ksztyber@nvidia.com>
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
Reviewed-by: default avatarAmit Engel <amit.engel@dell.com>
Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
parent acc3c993
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -262,3 +262,6 @@ CONFIG_COPY_FILE_RANGE=n

# liblz4 is available
CONFIG_HAVE_LZ4=n

# libaio has the RW flags (version >= 0.3.111)
CONFIG_AIO_HAVE_RW_FLAGS=n
+8 −0
Original line number Diff line number Diff line
@@ -1187,6 +1187,14 @@ if echo -e '#include <lz4.h>\nint main(void) { return 0; }\n' \
	CONFIG[HAVE_LZ4]="y"
fi

if [[ $sys_name == "Linux" ]]; then
	# iocb.aio_rw_flags and io_prep_preadv2 are part of the same feature in libaio: http://pagure.io/libaio/c/a6f40
	if echo -e '#include <libaio.h>\n#include <stddef.h>\nint main(void) { io_prep_preadv2(NULL, 0, NULL, 0, 0, 0); return 0; }' \
		| "${BUILD_CMD[@]}" -laio - 2> /dev/null; then
		CONFIG[AIO_HAVE_RW_FLAGS]="y"
	fi
fi

if [[ "${CONFIG[OCF]}" = "y" ]]; then
	# If OCF_PATH is a file, assume it is a library and use it to compile with
	if [ -f ${CONFIG[OCF_PATH]} ]; then
+1 −1
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ bdev_aio_submit_io(enum spdk_bdev_io_type type, struct file_disk *fdisk,
		io_set_eventfd(iocb, aio_ch->group_ch->efd);
	}
	iocb->data = aio_task;
#ifdef RWF_NOWAIT
#if defined(RWF_NOWAIT) && defined(SPDK_CONFIG_AIO_HAVE_RW_FLAGS)
	if (fdisk->use_nowait) {
		iocb->aio_rw_flags = RWF_NOWAIT;
	}