projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix for file_service_type=random
[fio.git]
/
io_u.c
diff --git
a/io_u.c
b/io_u.c
index 978771e1370378ada310bc303b686f20fd7a2763..6df4b5eee80190187aa0015b11aca7da73e714b4 100644
(file)
--- a/
io_u.c
+++ b/
io_u.c
@@
-329,11
+329,12
@@
static void io_u_mark_latency(struct thread_data *td, unsigned long msec)
*/
static struct fio_file *get_next_file_rand(struct thread_data *td)
{
*/
static struct fio_file *get_next_file_rand(struct thread_data *td)
{
- long r = os_random_long(&td->next_file_state);
unsigned int fileno;
struct fio_file *f;
do {
unsigned int fileno;
struct fio_file *f;
do {
+ long r = os_random_long(&td->next_file_state);
+
fileno = (unsigned int) ((double) (td->nr_files - 1) * r / (RAND_MAX + 1.0));
f = &td->files[fileno];
if (f->fd != -1)
fileno = (unsigned int) ((double) (td->nr_files - 1) * r / (RAND_MAX + 1.0));
f = &td->files[fileno];
if (f->fd != -1)