From ff00f247a6e764ec445aefc1ab6acf3c0817ca65 Mon Sep 17 00:00:00 2001 From: Niklas Cassel Date: Fri, 12 Nov 2021 09:54:41 +0000 Subject: [PATCH] libaio,io_uring: rename prio_prep() to include cmdprio in the name The default priority (which is either 0 or the value set by "prio" and "prioclass" options, will now be used regardless if prio_prep() is called or not. This is true for both libaio and io_uring. The way to think about it is that prio_prep() is only called if cmdprio_percentage/cmdprio_bssplit is used. prio_prep() might then override the default priority, if the random value happens to say that this I/O should use the cmdprio_value, rather than the default priority. Rename the prio_prep() functions to highlight that these functions are now only called if cmdprio is used. (If only option "prio"/"prioclass" is used, that is handled elsewhere.) Signed-off-by: Niklas Cassel Reviewed-by: Damien Le Moal Link: https://lore.kernel.org/r/20211112095428.158300-6-Niklas.Cassel@wdc.com Signed-off-by: Jens Axboe --- engines/io_uring.c | 7 ++++--- engines/libaio.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/engines/io_uring.c b/engines/io_uring.c index 7a2b20ec..0568b8f7 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -346,7 +346,7 @@ static int fio_ioring_prep(struct thread_data *td, struct io_u *io_u) * to be inherited. * td->ioprio will have the value of the "default prio", so set * this unconditionally. This value might get overridden by - * fio_ioring_prio_prep() if the option cmdprio_percentage or + * fio_ioring_cmdprio_prep() if the option cmdprio_percentage or * cmdprio_bssplit is used. */ sqe->ioprio = td->ioprio; @@ -456,7 +456,7 @@ static int fio_ioring_getevents(struct thread_data *td, unsigned int min, return r < 0 ? r : events; } -static void fio_ioring_prio_prep(struct thread_data *td, struct io_u *io_u) +static void fio_ioring_cmdprio_prep(struct thread_data *td, struct io_u *io_u) { struct ioring_options *o = td->eo; struct ioring_data *ld = td->io_ops_data; @@ -517,7 +517,8 @@ static enum fio_q_status fio_ioring_queue(struct thread_data *td, return FIO_Q_BUSY; if (ld->use_cmdprio) - fio_ioring_prio_prep(td, io_u); + fio_ioring_cmdprio_prep(td, io_u); + ring->array[tail & ld->sq_ring_mask] = io_u->index; atomic_store_release(ring->tail, next_tail); diff --git a/engines/libaio.c b/engines/libaio.c index dd655355..9c14dd88 100644 --- a/engines/libaio.c +++ b/engines/libaio.c @@ -205,7 +205,7 @@ static int fio_libaio_prep(struct thread_data *td, struct io_u *io_u) return 0; } -static void fio_libaio_prio_prep(struct thread_data *td, struct io_u *io_u) +static void fio_libaio_cmdprio_prep(struct thread_data *td, struct io_u *io_u) { struct libaio_options *o = td->eo; struct cmdprio *cmdprio = &o->cmdprio; @@ -369,7 +369,7 @@ static enum fio_q_status fio_libaio_queue(struct thread_data *td, } if (ld->use_cmdprio) - fio_libaio_prio_prep(td, io_u); + fio_libaio_cmdprio_prep(td, io_u); ld->iocbs[ld->head] = &io_u->iocb; ld->io_us[ld->head] = io_u; -- 2.25.1