Skip to content

Commit 433f390

Browse files
committed
Merge branch 'io_uring-depth'
* io_uring-depth: engines/io_uring: don't mess with non power-of-2 queue depth
2 parents 6a193ce + af0ad0f commit 433f390

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

engines/io_uring.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,8 @@ static enum fio_q_status fio_ioring_queue(struct thread_data *td,
770770

771771
fio_ro_check(td, io_u);
772772

773-
if (ld->queued == ld->iodepth)
773+
/* should not hit... */
774+
if (ld->queued == td->o.iodepth)
774775
return FIO_Q_BUSY;
775776

776777
/* if async trim has been tried and failed, punt to sync */
@@ -1006,7 +1007,7 @@ static int fio_ioring_queue_init(struct thread_data *td)
10061007
{
10071008
struct ioring_data *ld = td->io_ops_data;
10081009
struct ioring_options *o = td->eo;
1009-
int depth = td->o.iodepth;
1010+
int depth = ld->iodepth;
10101011
struct io_uring_params p;
10111012
int ret;
10121013

@@ -1086,7 +1087,7 @@ static int fio_ioring_cmd_queue_init(struct thread_data *td)
10861087
{
10871088
struct ioring_data *ld = td->io_ops_data;
10881089
struct ioring_options *o = td->eo;
1089-
int depth = td->o.iodepth;
1090+
int depth = ld->iodepth;
10901091
struct io_uring_params p;
10911092
int ret;
10921093

@@ -1231,7 +1232,7 @@ static int fio_ioring_post_init(struct thread_data *td)
12311232
return 1;
12321233
}
12331234

1234-
for (i = 0; i < td->o.iodepth; i++) {
1235+
for (i = 0; i < ld->iodepth; i++) {
12351236
struct io_uring_sqe *sqe;
12361237

12371238
sqe = &ld->sqes[i];
@@ -1272,7 +1273,7 @@ static int fio_ioring_cmd_post_init(struct thread_data *td)
12721273
return 1;
12731274
}
12741275

1275-
for (i = 0; i < td->o.iodepth; i++) {
1276+
for (i = 0; i < ld->iodepth; i++) {
12761277
struct io_uring_sqe *sqe;
12771278

12781279
if (o->cmd_type == FIO_URING_CMD_NVME) {
@@ -1330,9 +1331,13 @@ static int fio_ioring_init(struct thread_data *td)
13301331

13311332
ld = calloc(1, sizeof(*ld));
13321333

1333-
/* ring depth must be a power-of-2 */
1334-
ld->iodepth = td->o.iodepth;
1335-
td->o.iodepth = roundup_pow2(td->o.iodepth);
1334+
/*
1335+
* The internal io_uring queue depth must be a power-of-2, as that's
1336+
* how the ring interface works. So round that up, in case the user
1337+
* set iodepth isn't a power-of-2. Leave the fio depth the same, as
1338+
* not to be driving too much of an iodepth, if we did round up.
1339+
*/
1340+
ld->iodepth = roundup_pow2(td->o.iodepth);
13361341

13371342
/* io_u index */
13381343
ld->io_u_index = calloc(td->o.iodepth, sizeof(struct io_u *));
@@ -1362,7 +1367,7 @@ static int fio_ioring_init(struct thread_data *td)
13621367
}
13631368
parse_prchk_flags(o);
13641369

1365-
ld->iovecs = calloc(td->o.iodepth, sizeof(struct iovec));
1370+
ld->iovecs = calloc(ld->iodepth, sizeof(struct iovec));
13661371

13671372
td->io_ops_data = ld;
13681373

0 commit comments

Comments
 (0)