io_u->buf = p + max_bs * i;
dprint(FD_MEM, "io_u %p, mem %p\n", io_u, io_u->buf);
- if (td_write(td) && !td->o.refill_buffers)
+ if (td_write(td))
io_u_fill_buffer(td, io_u, max_bs);
- else if (td_write(td) && td->o.verify_pattern_bytes) {
+ if (td_write(td) && td->o.verify_pattern_bytes) {
/*
* Fill the buffer with the pattern if we are
* going to be doing writes.
arch_init(envp);
sinit();
- init_rand(&__fio_rand_state);
/*
* We need locale for number printing, if it isn't set then just
char *sysfs_root;
- unsigned long rand_seeds[7];
+ unsigned long rand_seeds[8];
union {
os_random_state_t bsrange_state;
struct frand_state __trim_state;
};
+ struct frand_state buf_state;
+
unsigned int verify_batch;
unsigned int trim_batch;
td_fill_rand_seeds_os(td);
else
td_fill_rand_seeds_internal(td);
+
+ init_rand_seed(&td->buf_state, td->rand_seeds[7]);
}
/*
io_u->buf_filled_len = 0;
if (!td->o.zero_buffers)
- fill_random_buf(io_u->buf, max_bs);
+ fill_random_buf(&td->buf_state, io_u->buf, max_bs);
else
memset(io_u->buf, 0, max_bs);
}
#include "rand.h"
#include "../hash.h"
-struct frand_state __fio_rand_state;
-
static inline int __seed(unsigned int x, unsigned int m)
{
return (x < m) ? x + m : x;
}
}
-unsigned long fill_random_buf(void *buf, unsigned int len)
+unsigned long fill_random_buf(struct frand_state *fs, void *buf,
+ unsigned int len)
{
- unsigned long r = __rand(&__fio_rand_state);
+ unsigned long r = __rand(fs);
if (sizeof(int) != sizeof(long *))
- r *= (unsigned long) __rand(&__fio_rand_state);
+ r *= (unsigned long) __rand(fs);
__fill_random_buf(buf, len, r);
return r;
unsigned int s1, s2, s3;
};
-extern struct frand_state __fio_rand_state;
-
static inline unsigned int __rand(struct frand_state *state)
{
#define TAUSWORTHE(s,a,b,c,d) ((s&c)<<d) ^ (((s <<a) ^ s)>>b)
extern void init_rand(struct frand_state *);
extern void init_rand_seed(struct frand_state *, unsigned int seed);
extern void __fill_random_buf(void *buf, unsigned int len, unsigned long seed);
-extern unsigned long fill_random_buf(void *buf, unsigned int len);
+extern unsigned long fill_random_buf(struct frand_state *, void *buf, unsigned int len);
#endif
if (use_seed)
__fill_random_buf(p, len, seed);
else
- io_u->rand_seed = fill_random_buf(p, len);
+ io_u->rand_seed = fill_random_buf(&td->buf_state, p, len);
break;
case 1:
/*