Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Nov 3, 2017

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit c89daa4a98e6f3749ffc75b727a77cc061a0a454:

io_u: reset file to initial offset (2017-11-01 14:51:03 -0600)

are available in the git repository at:

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

for you to fetch changes up to 34851ad5ffacf9f4f8a7f23ee2edb17281b917a0:

io_u_queue: convert rings to bool (2017-11-02 12:26:39 -0600)

----------------------------------------------------------------
Jens Axboe (9):
filesetup: don't print non-debug error on native fallocate failure
filesetup: don't inline native_fallocate()
filesetup: pre_read_files() can use a bool
filesetup: __init_rand_distribution() can be void
filesetup: change random file init to be bool based
filesetup: create_work_dirs() can return bool
filesetup: recurse_dir() can use bool
filesetup: allocate 'r' locally in fallocate_file()
io_u_queue: convert rings to bool

 backend.c    | 14 +++++-----
 file.h       |  4 +--
 filesetup.c  | 85 ++++++++++++++++++++++++++++++------------------------------
 io_u_queue.c | 12 ++++-----
 io_u_queue.h |  5 ++--
 5 files changed, 59 insertions(+), 61 deletions(-)

---

Diff of recent changes:

backend.c +6 -8
index c14f37c..7cf9b38 100644
@@ -1203,9 +1203,9 @@ static int init_io_u(struct thread_data *td)
 		data_xfer = 0;
 
 	err = 0;
-	err += io_u_rinit(&td->io_u_requeues, td->o.iodepth);
-	err += io_u_qinit(&td->io_u_freelist, td->o.iodepth);
-	err += io_u_qinit(&td->io_u_all, td->o.iodepth);
+	err += !io_u_rinit(&td->io_u_requeues, td->o.iodepth);
+	err += !io_u_qinit(&td->io_u_freelist, td->o.iodepth);
+	err += !io_u_qinit(&td->io_u_all, td->o.iodepth);
 
 	if (err) {
 		log_err("fio: failed setting up IO queues\n");
@@ -1692,16 +1692,14 @@ static void *thread_main(void *data)
 	if (td_io_init(td))
 		goto err;
 
-	if (init_random_map(td))
+	if (!init_random_map(td))
 		goto err;
 
 	if (o->exec_prerun && exec_string(o, o->exec_prerun, (const char *)"prerun"))
 		goto err;
 
-	if (o->pre_read) {
-		if (pre_read_files(td) < 0)
-			goto err;
-	}
+	if (o->pre_read && !pre_read_files(td))
+		goto err;
 
 	fio_verify_init(td);
 
file.h +2 -2
index e3864ee..cc721ee 100644
@@ -198,7 +198,7 @@ extern int __must_check generic_get_file_size(struct thread_data *, struct fio_f
 }
 #endif
 extern int __must_check file_lookup_open(struct fio_file *f, int flags);
-extern int __must_check pre_read_files(struct thread_data *);
+extern bool __must_check pre_read_files(struct thread_data *);
 extern unsigned long long get_rand_file_size(struct thread_data *td);
 extern int add_file(struct thread_data *, const char *, int, int);
 extern int add_file_exclusive(struct thread_data *, const char *);
@@ -209,7 +209,7 @@ extern void lock_file(struct thread_data *, struct fio_file *, enum fio_ddir);
 extern void unlock_file(struct thread_data *, struct fio_file *);
 extern void unlock_file_all(struct thread_data *, struct fio_file *);
 extern int add_dir_files(struct thread_data *, const char *);
-extern int init_random_map(struct thread_data *);
+extern bool init_random_map(struct thread_data *);
 extern void dup_files(struct thread_data *, struct thread_data *);
 extern int get_fileno(struct thread_data *, const char *);
 extern void free_release_files(struct thread_data *);
filesetup.c +42 -43

269 lines not on this page · raw message

io_u_queue.c +6 -6
index 9994c78..8cf4c8c 100644
@@ -1,15 +1,15 @@
 #include <stdlib.h>
 #include "io_u_queue.h"
 
-int io_u_qinit(struct io_u_queue *q, unsigned int nr)
+bool io_u_qinit(struct io_u_queue *q, unsigned int nr)
 {
 	q->io_us = calloc(nr, sizeof(struct io_u *));
 	if (!q->io_us)
-		return 1;
+		return false;
 
 	q->nr = 0;
 	q->max = nr;
-	return 0;
+	return true;
 }
 
 void io_u_qexit(struct io_u_queue *q)
@@ -17,7 +17,7 @@ void io_u_qexit(struct io_u_queue *q)
 	free(q->io_us);
 }
 
-int io_u_rinit(struct io_u_ring *ring, unsigned int nr)
+bool io_u_rinit(struct io_u_ring *ring, unsigned int nr)
 {
 	ring->max = nr + 1;
 	if (ring->max & (ring->max - 1)) {
@@ -32,10 +32,10 @@ int io_u_rinit(struct io_u_ring *ring, unsigned int nr)
 
 	ring->ring = calloc(ring->max, sizeof(struct io_u *));
 	if (!ring->ring)
-		return 1;
+		return false;
 
 	ring->head = ring->tail = 0;
-	return 0;
+	return true;
 }
 
 void io_u_rexit(struct io_u_ring *ring)
io_u_queue.h +3 -2
index 118e593..b5b8d2f 100644
@@ -2,6 +2,7 @@
 #define FIO_IO_U_QUEUE
 
 #include <assert.h>
+#include "lib/types.h"
 
 struct io_u;
 
@@ -42,7 +43,7 @@ static inline int io_u_qempty(const struct io_u_queue *q)
 #define io_u_qiter(q, io_u, i)	\
 	for (i = 0; i < (q)->nr && (io_u = (q)->io_us[i]); i++)
 
-int io_u_qinit(struct io_u_queue *q, unsigned int nr);
+bool io_u_qinit(struct io_u_queue *q, unsigned int nr);
 void io_u_qexit(struct io_u_queue *q);
 
 struct io_u_ring {
@@ -52,7 +53,7 @@ struct io_u_ring {
 	struct io_u **ring;
 };
 
-int io_u_rinit(struct io_u_ring *ring, unsigned int nr);
+bool io_u_rinit(struct io_u_ring *ring, unsigned int nr);
 void io_u_rexit(struct io_u_ring *ring);
 
 static inline void io_u_rpush(struct io_u_ring *r, struct io_u *io_u)