Add support for randomness of any IO direction

sequential_random used to be applied to all of the IO
directions, with no possibility of having different settings
for reads, writes, and trims. Now it supports setting each of
them individually.

By default, if you do:

sequential_random=50

it will still apply to all three. If you do:

sequential_random=10,90,80

you would get reads 10% random, writes 90% random, and trims
80% random.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/io_u.c b/io_u.c
index 865c582..8401719 100644
--- a/io_u.c
+++ b/io_u.c
@@ -191,23 +191,23 @@
 	return 1;
 }
 
-static int should_do_random(struct thread_data *td)
+static int should_do_random(struct thread_data *td, enum fio_ddir ddir)
 {
 	unsigned int v;
 	unsigned long r;
 
-	if (td->o.perc_rand == 100)
+	if (td->o.perc_rand[ddir] == 100)
 		return 1;
 
 	if (td->o.use_os_rand) {
-		r = os_random_long(&td->seq_rand_state);
+		r = os_random_long(&td->seq_rand_state[ddir]);
 		v = 1 + (int) (100.0 * (r / (OS_RAND_MAX + 1.0)));
 	} else {
-		r = __rand(&td->__seq_rand_state);
+		r = __rand(&td->__seq_rand_state[ddir]);
 		v = 1 + (int) (100.0 * (r / (FRAND_MAX + 1.0)));
 	}
 
-	return v <= td->o.perc_rand;
+	return v <= td->o.perc_rand[ddir];
 }
 
 static int get_next_rand_offset(struct thread_data *td, struct fio_file *f,
@@ -305,7 +305,7 @@
 
 	if (rw_seq) {
 		if (td_random(td)) {
-			if (should_do_random(td))
+			if (should_do_random(td, ddir))
 				ret = get_next_rand_block(td, f, ddir, &b);
 			else {
 				io_u->flags |= IO_U_F_BUSY_OK;