io_u_queue: convert rings to bool
authorJens Axboe <axboe@kernel.dk>
Thu, 2 Nov 2017 18:26:39 +0000 (12:26 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 2 Nov 2017 18:26:39 +0000 (12:26 -0600)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
backend.c
io_u_queue.c
io_u_queue.h

index d3e9bf8160615b64ae714b47f4524403df272f44..7cf9b382703ecac53d4998d56951b15b40c12ddf 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -1203,9 +1203,9 @@ static int init_io_u(struct thread_data *td)
                data_xfer = 0;
 
        err = 0;
                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");
 
        if (err) {
                log_err("fio: failed setting up IO queues\n");
index 9994c7879a066a6b277b1863bd6e7f902ba01795..8cf4c8c3d702234a1cc0b0ba5ffee83ef3a4687a 100644 (file)
@@ -1,15 +1,15 @@
 #include <stdlib.h>
 #include "io_u_queue.h"
 
 #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)
 {
        q->io_us = calloc(nr, sizeof(struct io_u *));
        if (!q->io_us)
-               return 1;
+               return false;
 
        q->nr = 0;
        q->max = nr;
 
        q->nr = 0;
        q->max = nr;
-       return 0;
+       return true;
 }
 
 void io_u_qexit(struct io_u_queue *q)
 }
 
 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);
 }
 
        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)) {
 {
        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)
 
        ring->ring = calloc(ring->max, sizeof(struct io_u *));
        if (!ring->ring)
-               return 1;
+               return false;
 
        ring->head = ring->tail = 0;
 
        ring->head = ring->tail = 0;
-       return 0;
+       return true;
 }
 
 void io_u_rexit(struct io_u_ring *ring)
 }
 
 void io_u_rexit(struct io_u_ring *ring)
index 118e59342b5da4bd814be51aa7f561d519603838..b5b8d2faf3d9ae76cc5ae6a102b6785af47dd5c5 100644 (file)
@@ -2,6 +2,7 @@
 #define FIO_IO_U_QUEUE
 
 #include <assert.h>
 #define FIO_IO_U_QUEUE
 
 #include <assert.h>
+#include "lib/types.h"
 
 struct io_u;
 
 
 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++)
 
 #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 {
 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;
 };
 
        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)
 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)