Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Jul 28, 2020 Library code

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 11b280c158db01744effde3863bfe9c65f7af090:

t/jobs/t001[1-2].fio: run for 10 seconds instead of 3 (2020-07-26 22:19:47 -0600)

are available in the Git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to b5aba537d844f73187eb931179ac59e7da570e7c:

iolog: ensure that dynamic log entries are at least queue depth sized (2020-07-27 16:00:20 -0600)

----------------------------------------------------------------
Jens Axboe (2):
Add roundup_pow2() as a generic helper
iolog: ensure that dynamic log entries are at least queue depth sized

 engines/io_uring.c |  6 +-----
 iolog.c            |  6 +++++-
 lib/roundup.h      | 11 +++++++++++
 3 files changed, 17 insertions(+), 6 deletions(-)
 create mode 100644 lib/roundup.h

---

Diff of recent changes:

engines/io_uring.c +1 -5
index ecff0657..0ccd2318 100644
@@ -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;
iolog.c +5 -1
index 4a79fc46..4af10da3 100644
@@ -19,6 +19,7 @@
 #include "smalloc.h"
 #include "blktrace.h"
 #include "pshared.h"
+#include "lib/roundup.h"
 
 #include <netinet/in.h>
 #include <netinet/tcp.h>
@@ -748,10 +749,13 @@ void setup_log(struct io_log **log, struct log_params *p,
 	}
 
 	if (l->td && l->td->o.io_submit_mode != IO_MODE_OFFLOAD) {
+		unsigned int def_samples = DEF_LOG_ENTRIES;
 		struct io_logs *__p;
 
 		__p = calloc(1, sizeof(*l->pending));
-		__p->max_samples = DEF_LOG_ENTRIES;
+		if (l->td->o.iodepth > DEF_LOG_ENTRIES)
+			def_samples = roundup_pow2(l->td->o.iodepth);
+		__p->max_samples = def_samples;
 		__p->log = calloc(__p->max_samples, log_entry_sz(l));
 		l->pending = __p;
 	}
lib/roundup.h new file +11 -0
new file mode 100644
index 00000000..5a99c8ac
@@ -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