bdev/uring: Do not use IORING_SETUP_IOPOLL.
Because of the Linux kernel has limitation, IORING_SETUP_IOPOLL is only used for local devices (e.g., local files, pcie NVMe SSDs etc.). However, it does not work for devices atttached from the remote. So in order to make bdev uring generic, Let's do not use IORING_SETUP_IOPOLL to create the uring. Change-Id: I6aea1ff222a8a0d67ab040ada75aa0ef6730e725 Signed-off-by: Ziye Yang <ziye.yang@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3587 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
864d93c053
commit
cca62c633f
@ -36,16 +36,4 @@
|
|||||||
|
|
||||||
#include <liburing.h>
|
#include <liburing.h>
|
||||||
|
|
||||||
#ifndef __NR_sys_io_uring_enter
|
|
||||||
#define __NR_sys_io_uring_enter 426
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int
|
|
||||||
spdk_io_uring_enter(int ring_fd, unsigned int to_submit,
|
|
||||||
unsigned int min_complete, unsigned int flags)
|
|
||||||
{
|
|
||||||
return syscall(__NR_sys_io_uring_enter, ring_fd, to_submit,
|
|
||||||
min_complete, flags, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* SPDK_INTERNAL_URING_H */
|
#endif /* SPDK_INTERNAL_URING_H */
|
||||||
|
@ -244,26 +244,20 @@ bdev_uring_group_poll(void *arg)
|
|||||||
int count, ret;
|
int count, ret;
|
||||||
|
|
||||||
to_submit = group_ch->io_pending;
|
to_submit = group_ch->io_pending;
|
||||||
to_complete = group_ch->io_inflight;
|
|
||||||
|
|
||||||
ret = 0;
|
|
||||||
if (to_submit > 0) {
|
if (to_submit > 0) {
|
||||||
/* If there are I/O to submit, use io_uring_submit here.
|
/* If there are I/O to submit, use io_uring_submit here.
|
||||||
* It will automatically call spdk_io_uring_enter appropriately. */
|
* It will automatically call spdk_io_uring_enter appropriately. */
|
||||||
ret = io_uring_submit(&group_ch->uring);
|
ret = io_uring_submit(&group_ch->uring);
|
||||||
group_ch->io_pending = 0;
|
|
||||||
group_ch->io_inflight += to_submit;
|
|
||||||
} else if (to_complete > 0) {
|
|
||||||
/* If there are I/O in flight but none to submit, we need to
|
|
||||||
* call io_uring_enter ourselves. */
|
|
||||||
ret = spdk_io_uring_enter(group_ch->uring.ring_fd, 0, 0,
|
|
||||||
IORING_ENTER_GETEVENTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return SPDK_POLLER_BUSY;
|
return SPDK_POLLER_BUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
group_ch->io_pending = 0;
|
||||||
|
group_ch->io_inflight += to_submit;
|
||||||
|
}
|
||||||
|
|
||||||
|
to_complete = group_ch->io_inflight;
|
||||||
count = 0;
|
count = 0;
|
||||||
if (to_complete > 0) {
|
if (to_complete > 0) {
|
||||||
count = bdev_uring_reap(&group_ch->uring, to_complete);
|
count = bdev_uring_reap(&group_ch->uring, to_complete);
|
||||||
@ -426,7 +420,9 @@ bdev_uring_group_create_cb(void *io_device, void *ctx_buf)
|
|||||||
{
|
{
|
||||||
struct bdev_uring_group_channel *ch = ctx_buf;
|
struct bdev_uring_group_channel *ch = ctx_buf;
|
||||||
|
|
||||||
if (io_uring_queue_init(SPDK_URING_QUEUE_DEPTH, &ch->uring, IORING_SETUP_IOPOLL) < 0) {
|
/* Do not use IORING_SETUP_IOPOLL until the Linux kernel can support not only
|
||||||
|
* local devices but also devices attached from remote target */
|
||||||
|
if (io_uring_queue_init(SPDK_URING_QUEUE_DEPTH, &ch->uring, 0) < 0) {
|
||||||
SPDK_ERRLOG("uring I/O context setup failure\n");
|
SPDK_ERRLOG("uring I/O context setup failure\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user