@@ -759,7 +759,8 @@ static enum fio_q_status fio_ioring_queue(struct thread_data *td,
759759
760760 fio_ro_check (td , io_u );
761761
762- if (ld -> queued == ld -> iodepth )
762+ /* should not hit... */
763+ if (ld -> queued == td -> o .iodepth )
763764 return FIO_Q_BUSY ;
764765
765766 /* if async trim has been tried and failed, punt to sync */
@@ -995,7 +996,7 @@ static int fio_ioring_queue_init(struct thread_data *td)
995996{
996997 struct ioring_data * ld = td -> io_ops_data ;
997998 struct ioring_options * o = td -> eo ;
998- int depth = td -> o . iodepth ;
999+ int depth = ld -> iodepth ;
9991000 struct io_uring_params p ;
10001001 int ret ;
10011002
@@ -1075,7 +1076,7 @@ static int fio_ioring_cmd_queue_init(struct thread_data *td)
10751076{
10761077 struct ioring_data * ld = td -> io_ops_data ;
10771078 struct ioring_options * o = td -> eo ;
1078- int depth = td -> o . iodepth ;
1079+ int depth = ld -> iodepth ;
10791080 struct io_uring_params p ;
10801081 int ret ;
10811082
@@ -1220,7 +1221,7 @@ static int fio_ioring_post_init(struct thread_data *td)
12201221 return 1 ;
12211222 }
12221223
1223- for (i = 0 ; i < td -> o . iodepth ; i ++ ) {
1224+ for (i = 0 ; i < ld -> iodepth ; i ++ ) {
12241225 struct io_uring_sqe * sqe ;
12251226
12261227 sqe = & ld -> sqes [i ];
@@ -1261,7 +1262,7 @@ static int fio_ioring_cmd_post_init(struct thread_data *td)
12611262 return 1 ;
12621263 }
12631264
1264- for (i = 0 ; i < td -> o . iodepth ; i ++ ) {
1265+ for (i = 0 ; i < ld -> iodepth ; i ++ ) {
12651266 struct io_uring_sqe * sqe ;
12661267
12671268 if (o -> cmd_type == FIO_URING_CMD_NVME ) {
@@ -1319,9 +1320,13 @@ static int fio_ioring_init(struct thread_data *td)
13191320
13201321 ld = calloc (1 , sizeof (* ld ));
13211322
1322- /* ring depth must be a power-of-2 */
1323- ld -> iodepth = td -> o .iodepth ;
1324- td -> o .iodepth = roundup_pow2 (td -> o .iodepth );
1323+ /*
1324+ * The internal io_uring queue depth must be a power-of-2, as that's
1325+ * how the ring interface works. So round that up, in case the user
1326+ * set iodepth isn't a power-of-2. Leave the fio depth the same, as
1327+ * not to be driving too much of an iodepth, if we did round up.
1328+ */
1329+ ld -> iodepth = roundup_pow2 (td -> o .iodepth );
13251330
13261331 /* io_u index */
13271332 ld -> io_u_index = calloc (td -> o .iodepth , sizeof (struct io_u * ));
@@ -1351,7 +1356,7 @@ static int fio_ioring_init(struct thread_data *td)
13511356 }
13521357 parse_prchk_flags (o );
13531358
1354- ld -> iovecs = calloc (td -> o . iodepth , sizeof (struct iovec ));
1359+ ld -> iovecs = calloc (ld -> iodepth , sizeof (struct iovec ));
13551360
13561361 td -> io_ops_data = ld ;
13571362
0 commit comments