summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-07-27 16:00:03 -0600
committerJens Axboe <axboe@kernel.dk>2020-07-27 16:00:03 -0600
commit6d975f2c8c3061b1d39c121d509d866890afd162 (patch)
tree2a7ffd1753e8e6bd9d0b87e514425711a4ec3ab3
parent11b280c158db01744effde3863bfe9c65f7af090 (diff)
downloadfio-6d975f2c8c3061b1d39c121d509d866890afd162.tar.gz
fio-6d975f2c8c3061b1d39c121d509d866890afd162.tar.bz2
Add roundup_pow2() as a generic helper
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--engines/io_uring.c6
-rw-r--r--lib/roundup.h11
2 files changed, 12 insertions, 5 deletions
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