Since os/os.h is included by fio.h before other functions/structures
are even defined, it's better for os/os*.h not to have dependency on
those (in this case it's struct thread_data and duplicated td_fill_
rand_seeds() prototypes) unless really needed. os/os*.h are basically
collections of small wrappers over syscalls/etc whose idea is similar
but with difference interface among supported platforms, thus they
normally don't need to have dependency on fio functions/structures,
and in fact they're normally designed that way.
This commit gets rid of struct thread_data argument from an inlined
function init_random_state(), which was needed only to call another
function td_fill_rand_seeds(td). This can simply be called from
setup_random_seeds() after init_random_state() without making any
functional difference. Also rename init_random_state() to
init_random_seeds() as it only initializes random seeds now.
With this commit, struct thread_data is completely gone from os/.
struct fio_file is still there, but this is needed by Windows where
the idea of fd differs from unix like in general.
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
unsigned long seed;
unsigned int i;
unsigned long seed;
unsigned int i;
- if (!td->o.rand_repeatable && !fio_option_is_set(&td->o, rand_seed))
- return init_random_state(td, td->rand_seeds, sizeof(td->rand_seeds));
+ if (!td->o.rand_repeatable && !fio_option_is_set(&td->o, rand_seed)) {
+ int ret = init_random_seeds(td->rand_seeds, sizeof(td->rand_seeds));
+ if (!ret)
+ td_fill_rand_seeds(td);
+ return ret;
+ }
seed = td->o.rand_seed;
for (i = 0; i < 4; i++)
seed = td->o.rand_seed;
for (i = 0; i < 4; i++)
prev_group_jobs++;
if (setup_random_seeds(td)) {
prev_group_jobs++;
if (setup_random_seeds(td)) {
- td_verror(td, errno, "init_random_state");
+ td_verror(td, errno, "setup_random_seeds");
ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset);
ssize_t pwrite(int fildes, const void *buf, size_t nbyte,
off_t offset);
ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset);
ssize_t pwrite(int fildes, const void *buf, size_t nbyte,
off_t offset);
-extern void td_fill_rand_seeds(struct thread_data *);
static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
{
static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
{
-static inline int init_random_state(struct thread_data *td, unsigned long *rand_seeds, int size)
+static inline int init_random_seeds(unsigned long *rand_seeds, int size)
}
CryptReleaseContext(hCryptProv, 0);
}
CryptReleaseContext(hCryptProv, 0);
- td_fill_rand_seeds(td);
#endif
#ifdef FIO_USE_GENERIC_INIT_RANDOM_STATE
#endif
#ifdef FIO_USE_GENERIC_INIT_RANDOM_STATE
-extern void td_fill_rand_seeds(struct thread_data *td);
-/*
- * Initialize the various random states we need (random io, block size ranges,
- * read/write mix, etc).
- */
-static inline int init_random_state(struct thread_data *td, unsigned long *rand_seeds, int size)
+static inline int init_random_seeds(unsigned long *rand_seeds, int size)
- td_fill_rand_seeds(td);