|
| 1 | +diff --git a/CONFIG b/CONFIG |
| 2 | +index 89c34e90b..02ce04692 100644 |
| 3 | +--- a/CONFIG |
| 4 | ++++ b/CONFIG |
| 5 | +@@ -256,3 +256,6 @@ CONFIG_COPY_FILE_RANGE=n |
| 6 | + |
| 7 | + # liblz4 is available |
| 8 | + CONFIG_HAVE_LZ4=n |
| 9 | ++ |
| 10 | ++# aio_rw_flags are enabled |
| 11 | ++CONFIG_HAVE_AIO_RW_FLAGS=n |
| 12 | +diff --git a/configure b/configure |
| 13 | +index 26c9b0f4d..d8daedc37 100755 |
| 14 | +--- a/configure |
| 15 | ++++ b/configure |
| 16 | +@@ -860,6 +860,22 @@ if [[ $sys_name != "Linux" ]]; then |
| 17 | + fi |
| 18 | + fi |
| 19 | + |
| 20 | ++if echo -e '#include <linux/fs.h>\n' \ |
| 21 | ++ '#include <libaio.h>\n' \ |
| 22 | ++ '#include <stddef.h>\n' \ |
| 23 | ++ '#ifndef RWF_NOWAIT\n' \ |
| 24 | ++ '#error "No RWF_NOWAIT is defined"\n' \ |
| 25 | ++ '#endif\n' \ |
| 26 | ++ 'int main(int argc, char **argv) {\n' \ |
| 27 | ++ 'return offsetof(struct iocb, aio_rw_flags);\n}\n' \ |
| 28 | ++ | "${BUILD_CMD[@]}" -c - ; then |
| 29 | ++ echo HAVE_AIO_RW_FLAGS=YES |
| 30 | ++ CONFIG[HAVE_AIO_RW_FLAGS]="y" |
| 31 | ++else |
| 32 | ++ echo HAVE_AIO_RW_FLAGS=NO |
| 33 | ++ CONFIG[HAVE_AIO_RW_FLAGS]="n" |
| 34 | ++fi |
| 35 | ++ |
| 36 | + if [ "${CONFIG[RDMA]}" = "y" ]; then |
| 37 | + if [[ ! "${CONFIG[RDMA_PROV]}" == "verbs" ]] && [[ ! "${CONFIG[RDMA_PROV]}" == "mlx5_dv" ]]; then |
| 38 | + echo "Invalid RDMA provider specified, must be \"verbs\" or \"mlx5_dv\"" |
| 39 | +diff --git a/module/bdev/aio/bdev_aio.c b/module/bdev/aio/bdev_aio.c |
| 40 | +index b51d6c83a..01914fb9d 100644 |
| 41 | +--- a/module/bdev/aio/bdev_aio.c |
| 42 | ++++ b/module/bdev/aio/bdev_aio.c |
| 43 | +@@ -64,7 +64,7 @@ struct file_disk { |
| 44 | + struct spdk_bdev disk; |
| 45 | + char *filename; |
| 46 | + int fd; |
| 47 | +-#ifdef RWF_NOWAIT |
| 48 | ++#ifdef SPDK_CONFIG_HAVE_AIO_RW_FLAGS |
| 49 | + bool use_nowait; |
| 50 | + #endif |
| 51 | + TAILQ_ENTRY(file_disk) link; |
| 52 | +@@ -116,7 +116,7 @@ bdev_aio_open(struct file_disk *disk) |
| 53 | + { |
| 54 | + int fd; |
| 55 | + int io_flag = disk->readonly ? O_RDONLY : O_RDWR; |
| 56 | +-#ifdef RWF_NOWAIT |
| 57 | ++#ifdef SPDK_CONFIG_HAVE_AIO_RW_FLAGS |
| 58 | + struct stat st; |
| 59 | + #endif |
| 60 | + |
| 61 | +@@ -134,7 +134,7 @@ bdev_aio_open(struct file_disk *disk) |
| 62 | + |
| 63 | + disk->fd = fd; |
| 64 | + |
| 65 | +-#ifdef RWF_NOWAIT |
| 66 | ++#ifdef SPDK_CONFIG_HAVE_AIO_RW_FLAGS |
| 67 | + /* Some aio operations can block, for example if number outstanding |
| 68 | + * I/O exceeds number of block layer tags. But not all files can |
| 69 | + * support RWF_NOWAIT flag. So use RWF_NOWAIT on block devices only. |
| 70 | +@@ -212,7 +212,7 @@ bdev_aio_submit_io(enum spdk_bdev_io_type type, struct file_disk *fdisk, |
| 71 | + io_set_eventfd(iocb, aio_ch->group_ch->efd); |
| 72 | + } |
| 73 | + iocb->data = aio_task; |
| 74 | +-#ifdef RWF_NOWAIT |
| 75 | ++#ifdef SPDK_CONFIG_HAVE_AIO_RW_FLAGS |
| 76 | + if (fdisk->use_nowait) { |
| 77 | + iocb->aio_rw_flags = RWF_NOWAIT; |
| 78 | + } |
0 commit comments