summaryrefslogtreecommitdiff
path: root/lib/rand.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-07-15 09:54:03 -0600
committerJens Axboe <axboe@kernel.dk>2021-07-15 09:54:03 -0600
commitae5c7cdd710dfa97705d965dcf001a96504e5f31 (patch)
treeaf6159f11a6d31c1373884b83878e822a4f286b4 /lib/rand.h
parentaaedde68bfb2d15c3a444df496ba26ac0956445c (diff)
parent0d71aa983a4dce75a088b3a4831d5b217df066fb (diff)
downloadfio-ae5c7cdd710dfa97705d965dcf001a96504e5f31.tar.gz
fio-ae5c7cdd710dfa97705d965dcf001a96504e5f31.tar.bz2
Merge branch 'dedupe_workset' of https://github.com/bardavid/fio
* 'dedupe_workset' of https://github.com/bardavid/fio: dedupe: allow to generate dedupe buffers from working set
Diffstat (limited to 'lib/rand.h')
-rw-r--r--lib/rand.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/rand.h b/lib/rand.h
index 46c1c5e0..a8060045 100644
--- a/lib/rand.h
+++ b/lib/rand.h
@@ -150,6 +150,16 @@ static inline uint64_t rand_between(struct frand_state *state, uint64_t start,
return start + rand32_upto(state, end - start);
}
+static inline uint64_t __get_next_seed(struct frand_state *fs)
+{
+ uint64_t r = __rand(fs);
+
+ if (sizeof(int) != sizeof(long *))
+ r *= (unsigned long) __rand(fs);
+
+ return r;
+}
+
extern void init_rand(struct frand_state *, bool);
extern void init_rand_seed(struct frand_state *, uint64_t seed, bool);
extern void __fill_random_buf(void *buf, unsigned int len, uint64_t seed);