File tree 2 files changed +14
-11
lines changed
2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,10 @@ This feature can only be used when the ring has been setup with
26
26
and hence is using an offloaded approach to request submissions.
27
27
28
28
.SH RETURN VALUE
29
- On success it returns the free space. If the kernel does not support the
30
- feature, -EINVAL is returned.
29
+ On success it returns an amount of free entries in the SQ ring. If the kernel
30
+ does not support the feature, or the ring was not setup with
31
+ .B IORING_SETUP_SQPOLL,
32
+ -EINVAL is returned.
31
33
.SH SEE ALSO
32
34
.BR io_uring_submit (3),
33
35
.BR io_uring_wait_cqe (3),
Original file line number Diff line number Diff line change @@ -1093,20 +1093,21 @@ static inline unsigned io_uring_sq_space_left(const struct io_uring *ring)
1093
1093
}
1094
1094
1095
1095
/*
1096
- * Only applicable when using SQPOLL - allows the caller to wait for space
1097
- * to free up in the SQ ring, which happens when the kernel side thread has
1098
- * consumed one or more entries. If the SQ ring is currently non-full, no
1099
- * action is taken. Note: may return -EINVAL if the kernel doesn't support
1096
+ * Only applicable when using SQPOLL - allows the caller to wait for an at
1097
+ * least one free entry in the SQ ring, which happens when the kernel side
1098
+ * thread has consumed one or more entries. If the SQ ring is currently
1099
+ * non-full, no waiting occured and an amout of free entries is returned
1100
+ * immediately. Note: may also return -EINVAL if the kernel doesn't support
1100
1101
* this feature.
1101
1102
*/
1102
1103
static inline int io_uring_sqring_wait (struct io_uring * ring )
1103
1104
{
1104
- if (!(ring -> flags & IORING_SETUP_SQPOLL ))
1105
- return 0 ;
1106
- if (io_uring_sq_space_left (ring ))
1107
- return 0 ;
1105
+ int ret ;
1108
1106
1109
- return __io_uring_sqring_wait (ring );
1107
+ if (!(ring -> flags & IORING_SETUP_SQPOLL ))
1108
+ return - EINVAL ;
1109
+ return (ret = io_uring_sq_space_left (ring ))
1110
+ ? ret : __io_uring_sqring_wait (ring );
1110
1111
}
1111
1112
1112
1113
/*
You can’t perform that action at this time.
0 commit comments