Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
slash
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
slash
Commits
66a07c7a
Unverified
Commit
66a07c7a
authored
Jul 24, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test io_uring flags before using them
is there a better way?
https://github.com/axboe/liburing/issues/906
parent
ecf6f24c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
4 deletions
+39
-4
fellow_io_uring.c
src/fellow_io_uring.c
+39
-4
No files found.
src/fellow_io_uring.c
View file @
66a07c7a
...
@@ -226,6 +226,42 @@ test_task(struct worker *wrk, void *priv)
...
@@ -226,6 +226,42 @@ test_task(struct worker *wrk, void *priv)
/* XXX very simplistic. Sufficient for fellow, but not otherwise */
/* XXX very simplistic. Sufficient for fellow, but not otherwise */
static
int
shared_wq_fd
=
-
1
;
static
int
shared_wq_fd
=
-
1
;
/* XXX BETTER WAY? https://github.com/axboe/liburing/issues/906 */
static
unsigned
flags_checked
=
0
;
static
unsigned
flags_supported
=
0
;
static
unsigned
try_flag
(
unsigned
flag
)
{
struct
io_uring_params
params
;
struct
io_uring
ring
;
int
ret
;
memset
(
&
params
,
0
,
sizeof
params
);
params
.
flags
=
flag
;
ret
=
io_uring_queue_init_params
(
2
,
&
ring
,
&
params
);
if
(
ret
==
0
)
{
io_uring_queue_exit
(
&
ring
);
return
(
flag
);
}
assert
(
ret
==
-
EINVAL
);
return
(
0
);
}
static
void
try_flags
(
void
)
{
if
(
flags_checked
!=
0
)
return
;
#ifdef IORING_SETUP_COOP_TASKRUN
flags_supported
|=
try_flag
(
IORING_SETUP_COOP_TASKRUN
);
#endif
flags_checked
=
1
;
}
fellow_ioctx_t
*
fellow_ioctx_t
*
fellow_io_init
(
int
fd
,
unsigned
entries
,
void
*
base
,
size_t
len
,
fellow_io_init
(
int
fd
,
unsigned
entries
,
void
*
base
,
size_t
len
,
fellow_task_run_t
taskrun
)
fellow_task_run_t
taskrun
)
...
@@ -236,6 +272,8 @@ fellow_io_init(int fd, unsigned entries, void *base, size_t len,
...
@@ -236,6 +272,8 @@ fellow_io_init(int fd, unsigned entries, void *base, size_t len,
int
ret
,
answer
=
0
;
int
ret
,
answer
=
0
;
fellow_task_privstate
taskstate
;
fellow_task_privstate
taskstate
;
try_flags
();
probe
=
io_uring_get_probe
();
probe
=
io_uring_get_probe
();
if
(
probe
==
NULL
)
{
if
(
probe
==
NULL
)
{
fprintf
(
stderr
,
"io_uring_get_probe() failed
\n
"
);
fprintf
(
stderr
,
"io_uring_get_probe() failed
\n
"
);
...
@@ -250,10 +288,7 @@ fellow_io_init(int fd, unsigned entries, void *base, size_t len,
...
@@ -250,10 +288,7 @@ fellow_io_init(int fd, unsigned entries, void *base, size_t len,
AZ
(
taskrun
(
test_task
,
&
answer
,
&
taskstate
));
AZ
(
taskrun
(
test_task
,
&
answer
,
&
taskstate
));
memset
(
&
params
,
0
,
sizeof
params
);
memset
(
&
params
,
0
,
sizeof
params
);
params
.
flags
=
flags_supported
;
#ifdef IORING_SETUP_COOP_TASKRUN
params
.
flags
|=
IORING_SETUP_COOP_TASKRUN
;
#endif
#ifdef IORING_SETUP_ATTACH_WQ
#ifdef IORING_SETUP_ATTACH_WQ
if
(
shared_wq_fd
>=
0
)
{
if
(
shared_wq_fd
>=
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment