Recent changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following changes since commit c44b1ff54402c589e8f07436ec56efb4f8b1ac23:

  Add sub-option support (sort-of) and convert libaio_userspace_reap (2011-08-30 20:43:53 -0600)

are available in the git repository at:
  git://git.kernel.dk/fio.git master

Jens Axboe (6):
      Fix FIO_OPT_STR_STORE without posval
      Remove duplicate code in parser
      Add support for backwards holes
      Fix parser using uninitialized memory
      Ensure that buffer contents are random across jobs as well
      Only clear string pointer in parser for sub-value options

 fio.c      |    5 ++---
 fio.h      |    6 ++++--
 init.c     |    2 ++
 io_u.c     |    8 ++++++--
 lib/rand.c |    9 ++++-----
 lib/rand.h |    4 +---
 parse.c    |   12 +++++++++---
 verify.c   |    2 +-
 8 files changed, 29 insertions(+), 19 deletions(-)

---

Diff of recent changes:

diff --git a/fio.c b/fio.c
index 9c1bed3..4514840 100644
--- a/fio.c
+++ b/fio.c
@@ -874,9 +874,9 @@ static int init_io_u(struct thread_data *td)
 			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.
@@ -1699,7 +1699,6 @@ int main(int argc, char *argv[], char *envp[])
 	arch_init(envp);
 
 	sinit();
-	init_rand(&__fio_rand_state);
 
 	/*
 	 * We need locale for number printing, if it isn't set then just
diff --git a/fio.h b/fio.h
index 0c86f28..6eb270d 100644
--- a/fio.h
+++ b/fio.h
@@ -254,7 +254,7 @@ struct thread_options {
 	unsigned int rw_seq;
 	unsigned int kb_base;
 	unsigned int ddir_seq_nr;
-	unsigned long ddir_seq_add;
+	long ddir_seq_add;
 	unsigned int iodepth;
 	unsigned int iodepth_low;
 	unsigned int iodepth_batch;
@@ -460,7 +460,7 @@ struct thread_data {
 
 	char *sysfs_root;
 
-	unsigned long rand_seeds[7];
+	unsigned long rand_seeds[8];
 
 	union {
 		os_random_state_t bsrange_state;
@@ -475,6 +475,8 @@ struct thread_data {
 		struct frand_state __trim_state;
 	};
 
+	struct frand_state buf_state;
+
 	unsigned int verify_batch;
 	unsigned int trim_batch;
 
diff --git a/init.c b/init.c
index a920c6e..ed34269 100644
--- a/init.c
+++ b/init.c
@@ -515,6 +515,8 @@ void td_fill_rand_seeds(struct thread_data *td)
 		td_fill_rand_seeds_os(td);
 	else
 		td_fill_rand_seeds_internal(td);
+
+	init_rand_seed(&td->buf_state, td->rand_seeds[7]);
 }
 
 /*
diff --git a/io_u.c b/io_u.c
index 7709df5..a87c58e 100644
--- a/io_u.c
+++ b/io_u.c
@@ -249,8 +249,12 @@ static int get_next_seq_block(struct thread_data *td, struct fio_file *f,
 	assert(ddir_rw(ddir));
 
 	if (f->last_pos < f->real_file_size) {
-		unsigned long long pos = f->last_pos - f->file_offset;
+		unsigned long long pos;
 
+		if (f->last_pos == f->file_offset && td->o.ddir_seq_add < 0)
+			f->last_pos = f->real_file_size;
+
+		pos = f->last_pos - f->file_offset;
 		if (pos)
 			pos += td->o.ddir_seq_add;
 
@@ -1446,7 +1450,7 @@ void io_u_fill_buffer(struct thread_data *td, struct io_u *io_u,
 	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);
 }
diff --git a/lib/rand.c b/lib/rand.c
index 3b2d67a..7c6fed1 100644
--- a/lib/rand.c
+++ b/lib/rand.c
@@ -36,8 +36,6 @@
 #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;
@@ -79,12 +77,13 @@ void __fill_random_buf(void *buf, unsigned int len, unsigned long seed)
 	}
 }
 
-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;
diff --git a/lib/rand.h b/lib/rand.h
index f80c111..6b9e13c 100644
--- a/lib/rand.h
+++ b/lib/rand.h
@@ -7,8 +7,6 @@ struct frand_state {
 	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)
@@ -23,6 +21,6 @@ static inline unsigned int __rand(struct frand_state *state)
 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
diff --git a/parse.c b/parse.c
index 4458121..2dee446 100644
--- a/parse.c
+++ b/parse.c
@@ -192,10 +192,10 @@ static unsigned long long get_mult_bytes(const char *str, int len, void *data,
 		return __get_mult_bytes(str, data, percent);
 
         /*
-         * Go forward until we hit a non-digit
+         * Go forward until we hit a non-digit, or +/- sign
          */
 	while ((p - str) <= len) {
-		if (!isdigit((int) *p))
+		if (!isdigit((int) *p) && (*p != '+') && (*p != '-'))
 			break;
 		p++;
 	}
@@ -489,6 +489,11 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data,
 
 		posval_sort(o, posval);
 
+		if (!o->posval[0].ival) {
+			vp = NULL;
+			goto match;
+		}
+
 		ret = 1;
 		for (i = 0; i < PARSE_MAX_VP; i++) {
 			vp = &posval[i];
@@ -501,6 +506,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data,
 				ret = 0;
 				if (vp->cb)
 					fn = vp->cb;
+match:
 				if (o->roff1)
 					cp = (char **) o->roff1;
 				else
@@ -510,7 +516,7 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data,
 				if (rest) {
 					*rest = '\0';
 					ptr = rest + 1;
-				} else
+				} else if (vp && vp->cb)
 					ptr = NULL;
 				break;
 			}
diff --git a/verify.c b/verify.c
index fc207cf..c450e88 100644
--- a/verify.c
+++ b/verify.c
@@ -36,7 +36,7 @@ void fill_pattern(struct thread_data *td, void *p, unsigned int len, struct io_u
 		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:
 		/*
--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux