fdp: drop expensive modulo operation
authorAnkit Kumar <ankit.kumar@samsung.com>
Tue, 14 Mar 2023 09:26:26 +0000 (14:56 +0530)
committerAnkit Kumar <ankit.kumar@samsung.com>
Fri, 24 Mar 2023 15:34:22 +0000 (21:04 +0530)
Remove the usage of expensive modulo operation as the same can be easily
achieved with addition and wrapping around avilable reclaim unit handles.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
fdp.c

diff --git a/fdp.c b/fdp.c
index 84e04fce61f4bea57ee3c8b6db56dd2f176b65aa..d92dbc67cc05855e1a1fa954cd85c23079427941 100644 (file)
--- a/fdp.c
+++ b/fdp.c
@@ -119,7 +119,10 @@ void fdp_fill_dspec_data(struct thread_data *td, struct io_u *io_u)
                return;
        }
 
-       dspec = ruhs->plis[ruhs->pli_loc++ % ruhs->nr_ruhs];
+       if (ruhs->pli_loc >= ruhs->nr_ruhs)
+               ruhs->pli_loc = 0;
+
+       dspec = ruhs->plis[ruhs->pli_loc++];
        io_u->dtype = 2;
        io_u->dspec = dspec;
 }