Just some low hanging fruit.
Signed-off-by: Jens Axboe <axboe@fb.com>
#define fio_init __attribute__((constructor))
#define fio_exit __attribute__((destructor))
+#define fio_unlikely(x) __builtin_expect(!!(x), 0)
+
#endif
seed = td->rand_seeds[FIO_RAND_BLOCK_OFF];
- if (!lfsr_init(&f->lfsr, blocks, seed, seed & 0xF))
+ if (!lfsr_init(&f->lfsr, blocks, seed, 0))
continue;
} else if (!td->o.norandommap) {
f->io_axmap = axmap_new(blocks);
gtod_log_caller(caller);
#endif
- if (fio_tv) {
+ if (fio_unlikely(fio_tv)) {
memcpy(tp, fio_tv, sizeof(*tp));
return;
}
else if (!queue_full(td)) {
io_u = io_u_qpop(&td->io_u_freelist);
+ io_u->file = NULL;
io_u->buflen = 0;
io_u->resid = 0;
- io_u->file = NULL;
io_u->end_io = NULL;
}
struct io_piece *ipo;
+ unsigned int resid;
+ unsigned int error;
+
+ /*
+ * io engine private data
+ */
+ union {
+ unsigned int index;
+ unsigned int seen;
+ void *engine_data;
+ };
+
+ struct flist_head verify_list;
+
+ /*
+ * Callback for io completion
+ */
+ int (*end_io)(struct thread_data *, struct io_u *);
+
union {
#ifdef CONFIG_LIBAIO
struct iocb iocb;
#endif
void *mmap_data;
};
-
- unsigned int resid;
- unsigned int error;
-
- /*
- * io engine private data
- */
- union {
- unsigned int index;
- unsigned int seen;
- void *engine_data;
- };
-
- struct flist_head verify_list;
-
- /*
- * Callback for io completion
- */
- int (*end_io)(struct thread_data *, struct io_u *);
};
/*
#include <math.h>
#include "lfsr.h"
+#include "../compiler/compiler.h"
/*
* LFSR taps retrieved from:
if (fl->cycle_length && !--fl->cycle_length) {
__lfsr_next(fl, fl->spin + 1);
fl->cycle_length = fl->cached_cycle_length;
- goto check;
- }
- __lfsr_next(fl, fl->spin);
-check: ;
- } while (fl->last_val > fl->max_val);
+ } else
+ __lfsr_next(fl, fl->spin);
+ } while (fio_unlikely(fl->last_val > fl->max_val));
*off = fl->last_val;
return 0;