From: Jens Axboe Date: Mon, 27 Jul 2020 22:00:03 +0000 (-0600) Subject: Add roundup_pow2() as a generic helper X-Git-Tag: fio-3.22~18 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=6d975f2c8c3061b1d39c121d509d866890afd162;p=fio.git Add roundup_pow2() as a generic helper Signed-off-by: Jens Axboe --- diff --git a/engines/io_uring.c b/engines/io_uring.c index ecff0657..0ccd2318 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -17,6 +17,7 @@ #include "../optgroup.h" #include "../lib/memalign.h" #include "../lib/fls.h" +#include "../lib/roundup.h" #ifdef ARCH_HAVE_IOURING @@ -654,11 +655,6 @@ static int fio_ioring_post_init(struct thread_data *td) return 0; } -static unsigned roundup_pow2(unsigned depth) -{ - return 1UL << __fls(depth - 1); -} - static int fio_ioring_init(struct thread_data *td) { struct ioring_options *o = td->eo; diff --git a/lib/roundup.h b/lib/roundup.h new file mode 100644 index 00000000..5a99c8ac --- /dev/null +++ b/lib/roundup.h @@ -0,0 +1,11 @@ +#ifndef FIO_ROUNDUP_H +#define FIO_ROUNDUP_H + +#include "lib/fls.h" + +static inline unsigned roundup_pow2(unsigned depth) +{ + return 1UL << __fls(depth - 1); +} + +#endif