Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Nov 6, 2014

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 239b2882f467676b232e9e20b72c287b77bd3daa:

Add basic DragonFly support (2014-11-04 19:53:04 -0700)

are available in the git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to d6b72507e72d3f2ed334fa5665880b0ab59dbfdd:

Get rid of __ prefix for internal frand state (2014-11-05 18:39:23 -0700)

----------------------------------------------------------------
Jens Axboe (2):
Remove use of OS provided random functions Get rid of __ prefix for internal frand state

 HOWTO            |    6 ------
 backend.c        |    4 ++--
 cconv.c          |    2 --
 filesetup.c      |   13 +++---------
 fio.1            |    6 ------
 fio.h            |   43 ++++++++-----------------------------
 init.c           |   62 ++++++++++++------------------------------------------
 io_u.c           |   58 +++++++++++---------------------------------------
 options.c        |    8 ++-----
 thread_options.h |    4 ++--
 trim.c           |    9 ++------
 verify.c         |    6 +++---
 12 files changed, 49 insertions(+), 172 deletions(-)

---

Diff of recent changes:

HOWTO +0 -6
index e18eadb..73be9d7 100644
@@ -439,12 +439,6 @@ randseed=int	Seed the random number generators based on this seed value, to
 		If not set, the random sequence depends on the randrepeat
 		setting.
 
-use_os_rand=bool Fio can either use the random generator supplied by the OS
-		to generator random offsets, or it can use it's own internal
-		generator (based on Tausworthe). Default is to use the
-		internal generator, which is often of better quality and
-		faster.
-
 fallocate=str	Whether pre-allocation is performed when laying down files.
 		Accepted values are:
 
backend.c +2 -2
index d19d870..cae4e38 100644
@@ -753,9 +753,9 @@ static uint64_t do_io(struct thread_data *td)
 		    ((io_u->flags & IO_U_F_VER_LIST) || !td_rw(td))) {
 
 			if (!td->o.verify_pattern_bytes) {
-				io_u->rand_seed = __rand(&td->__verify_state);
+				io_u->rand_seed = __rand(&td->verify_state);
 				if (sizeof(int) != sizeof(long *))
-					io_u->rand_seed *= __rand(&td->__verify_state);
+					io_u->rand_seed *= __rand(&td->verify_state);
 			}
 
 			if (td->o.verify_async)
cconv.c +0 -2
index 4a40ed0..607cede 100644
@@ -149,7 +149,6 @@ void convert_thread_options_to_cpu(struct thread_options *o,
 	o->rand_repeatable = le32_to_cpu(top->rand_repeatable);
 	o->allrand_repeatable = le32_to_cpu(top->allrand_repeatable);
 	o->rand_seed = le64_to_cpu(top->rand_seed);
-	o->use_os_rand = le32_to_cpu(top->use_os_rand);
 	o->log_avg_msec = le32_to_cpu(top->log_avg_msec);
 	o->log_offset = le32_to_cpu(top->log_offset);
 	o->log_gz = le32_to_cpu(top->log_gz);
@@ -323,7 +322,6 @@ void convert_thread_options_to_net(struct thread_options_pack *top,
 	top->rand_repeatable = cpu_to_le32(o->rand_repeatable);
 	top->allrand_repeatable = cpu_to_le32(o->allrand_repeatable);
 	top->rand_seed = __cpu_to_le64(o->rand_seed);
-	top->use_os_rand = cpu_to_le32(o->use_os_rand);
 	top->log_avg_msec = cpu_to_le32(o->log_avg_msec);
 	top->log_offset = cpu_to_le32(o->log_offset);
 	top->log_gz = cpu_to_le32(o->log_gz);
filesetup.c +3 -10
index 43146ba..4026f4d 100644
@@ -261,16 +261,9 @@ static unsigned long long get_rand_file_size(struct thread_data *td)
 	unsigned long long ret, sized;
 	unsigned long r;
 
-	if (td->o.use_os_rand) {
-		r = os_random_long(&td->file_size_state);
-		sized = td->o.file_size_high - td->o.file_size_low;
-		ret = (unsigned long long) ((double) sized * (r / (OS_RAND_MAX + 1.0)));
-	} else {
-		r = __rand(&td->__file_size_state);
-		sized = td->o.file_size_high - td->o.file_size_low;
-		ret = (unsigned long long) ((double) sized * (r / (FRAND_MAX + 1.0)));
-	}
-
+	r = __rand(&td->file_size_state);
+	sized = td->o.file_size_high - td->o.file_size_low;
+	ret = (unsigned long long) ((double) sized * (r / (FRAND_MAX + 1.0)));
 	ret += td->o.file_size_low;
 	ret -= (ret % td->o.rw_min_bs);
 	return ret;
fio.1 +0 -6
index 8d02632..82868a8 100644
@@ -347,12 +347,6 @@ Seed the random number generators based on this seed value, to be able to
 control what sequence of output is being generated. If not set, the random
 sequence depends on the \fBrandrepeat\fR setting.
 .TP
-.BI use_os_rand \fR=\fPbool
-Fio can either use the random generator supplied by the OS to generate random
-offsets, or it can use its own internal generator (based on Tausworthe).
-Default is to use the internal generator, which is often of better quality and
-faster. Default: false.
-.TP
 .BI fallocate \fR=\fPstr
 Whether pre-allocation is performed when laying down files. Accepted values
 are:
fio.h +9 -34

79 lines not on this page · raw message

init.c +14 -48

91 lines not on this page · raw message

io_u.c +12 -46

108 lines not on this page · raw message

options.c +2 -6
index 918de8e..529b8f0 100644
@@ -1842,12 +1842,8 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
 	{
 		.name	= "use_os_rand",
 		.lname	= "Use OS random",
-		.type	= FIO_OPT_BOOL,
-		.off1	= td_var_offset(use_os_rand),
-		.help	= "Set to use OS random generator",
-		.def	= "0",
-		.parent = "rw",
-		.hide	= 1,
+		.type	= FIO_OPT_DEPRECATED,
+		.off1	= td_var_offset(dep_use_os_rand),
 		.category = FIO_OPT_C_IO,
 		.group	= FIO_OPT_G_RANDOM,
 	},
thread_options.h +2 -2
index ecf4e47..74c3e99 100644
@@ -106,7 +106,7 @@ struct thread_options {
 	unsigned int rand_repeatable;
 	unsigned int allrand_repeatable;
 	unsigned long long rand_seed;
-	unsigned int use_os_rand;
+	unsigned int dep_use_os_rand;
 	unsigned int log_avg_msec;
 	unsigned int log_offset;
 	unsigned int log_gz;
@@ -337,7 +337,7 @@ struct thread_options_pack {
 	uint32_t rand_repeatable;
 	uint32_t allrand_repeatable;
 	uint64_t rand_seed;
-	uint32_t use_os_rand;
+	uint32_t dep_use_os_rand;
 	uint32_t log_avg_msec;
 	uint32_t log_offset;
 	uint32_t log_gz;
trim.c +2 -7
index a7f1b86..95c433b 100644
@@ -75,13 +75,8 @@ int io_u_should_trim(struct thread_data *td, struct io_u *io_u)
 	if (!td->o.trim_percentage)
 		return 0;
 
-	if (td->o.use_os_rand) {
-		r = os_random_long(&td->trim_state);
-		val = (OS_RAND_MAX / 100ULL);
-	} else {
-		r = __rand(&td->__trim_state);
-		val = (FRAND_MAX / 100ULL);
-	}
+	r = __rand(&td->trim_state);
+	val = (FRAND_MAX / 100ULL);
 
 	val *= (unsigned long long) td->o.trim_percentage;
 	return r <= val;
verify.c +3 -3
index 35d8969..f5c009c 100644
@@ -73,7 +73,7 @@ void fill_verify_pattern(struct thread_data *td, void *p, unsigned int len,
 		if (use_seed)
 			__fill_random_buf(p, len, seed);
 		else
-			io_u->rand_seed = fill_random_buf(&td->__verify_state, p, len);
+			io_u->rand_seed = fill_random_buf(&td->verify_state, p, len);
 		return;
 	}
 
@@ -1140,9 +1140,9 @@ int get_next_verify(struct thread_data *td, struct io_u *io_u)
 		dprint(FD_VERIFY, "get_next_verify: ret io_u %p\n", io_u);
 
 		if (!td->o.verify_pattern_bytes) {
-			io_u->rand_seed = __rand(&td->__verify_state);
+			io_u->rand_seed = __rand(&td->verify_state);
 			if (sizeof(int) != sizeof(long *))
-				io_u->rand_seed *= __rand(&td->__verify_state);
+				io_u->rand_seed *= __rand(&td->verify_state);
 		}
 		return 0;
 	}