summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
38f30c8)
Currently we check for the max value, but that doesn't always
work since it may not fit the minimum block size (even if it
is guaranteed to be smaller than the max offset). Pass in the
last valid block.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_u->buflen = nr_blocks * min_bs;
}
io_u->buflen = nr_blocks * min_bs;
}
-static unsigned long long last_block(struct thread_data *td, struct fio_file *f,
- enum fio_ddir ddir)
+static uint64_t last_block(struct thread_data *td, struct fio_file *f,
+ enum fio_ddir ddir)
- unsigned long long max_blocks;
- unsigned long long max_size;
+ uint64_t max_blocks;
+ uint64_t max_size;
static int __get_next_rand_offset(struct thread_data *td, struct fio_file *f,
enum fio_ddir ddir, unsigned long long *b)
{
static int __get_next_rand_offset(struct thread_data *td, struct fio_file *f,
enum fio_ddir ddir, unsigned long long *b)
{
+ unsigned long long r, lastb;
- if (td->o.random_generator == FIO_RAND_GEN_TAUSWORTHE) {
- unsigned long long rmax, lastb;
+ lastb = last_block(td, f, ddir);
+ if (!lastb)
+ return 1;
- lastb = last_block(td, f, ddir);
- if (!lastb)
- return 1;
+ if (td->o.random_generator == FIO_RAND_GEN_TAUSWORTHE) {
+ unsigned long long rmax;
rmax = td->o.use_os_rand ? OS_RAND_MAX : FRAND_MAX;
rmax = td->o.use_os_rand ? OS_RAND_MAX : FRAND_MAX;
} else {
uint64_t off = 0;
} else {
uint64_t off = 0;
- if (lfsr_next(&f->lfsr, &off))
+ if (lfsr_next(&f->lfsr, &off, lastb))
return xor_mask | (v >> 1);
}
return xor_mask | (v >> 1);
}
-int lfsr_next(struct fio_lfsr *fl, uint64_t *off)
+int lfsr_next(struct fio_lfsr *fl, uint64_t *off, uint64_t last)
{
if (fl->num_vals > fl->max_val)
return 1;
do {
fl->last_val = __lfsr_next(fl->last_val, &fl->taps);
{
if (fl->num_vals > fl->max_val)
return 1;
do {
fl->last_val = __lfsr_next(fl->last_val, &fl->taps);
- if (fl->last_val - 1 <= fl->max_val)
+ if (fl->last_val - 1 <= fl->max_val &&
+ fl->last_val <= last)
struct lfsr_taps taps;
};
struct lfsr_taps taps;
};
-int lfsr_next(struct fio_lfsr *fl, uint64_t *off);
+int lfsr_next(struct fio_lfsr *fl, uint64_t *off, uint64_t);
int lfsr_init(struct fio_lfsr *fl, uint64_t size, unsigned long seed);
#endif
int lfsr_init(struct fio_lfsr *fl, uint64_t size, unsigned long seed);
#endif