Signed-off-by: Jens Axboe <axboe@kernel.dk>
- 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");
#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)
}
void io_u_qexit(struct io_u_queue *q)
}
void io_u_qexit(struct io_u_queue *q)
-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)) {
ring->ring = calloc(ring->max, sizeof(struct io_u *));
if (!ring->ring)
ring->ring = calloc(ring->max, sizeof(struct io_u *));
if (!ring->ring)
ring->head = ring->tail = 0;
ring->head = ring->tail = 0;
}
void io_u_rexit(struct io_u_ring *ring)
}
void io_u_rexit(struct io_u_ring *ring)
#define FIO_IO_U_QUEUE
#include <assert.h>
#define FIO_IO_U_QUEUE
#include <assert.h>
#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 {
-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)