Add roundup_pow2() as a generic helper
authorJens Axboe <axboe@kernel.dk>
Mon, 27 Jul 2020 22:00:03 +0000 (16:00 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 27 Jul 2020 22:00:03 +0000 (16:00 -0600)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/io_uring.c
lib/roundup.h [new file with mode: 0644]

index ecff0657ed51e60af19bce99a0be1d803c63dd82..0ccd23184fab3b17a9c68c93a9c30375b5673986 100644 (file)
@@ -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 (file)
index 0000000..5a99c8a
--- /dev/null
@@ -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