projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add support for options being a power-of-2
[fio.git]
/
io_u.c
diff --git
a/io_u.c
b/io_u.c
index ba3f7ca00fcd1db4f657f5dcf7321fc8c9f7ca0e..e67149d8cd2463e3bb8b06d18a70be9476b7b6d5 100644
(file)
--- a/
io_u.c
+++ b/
io_u.c
@@
-12,6
+12,7
@@
#include "lib/rand.h"
#include "lib/axmap.h"
#include "err.h"
#include "lib/rand.h"
#include "lib/axmap.h"
#include "err.h"
+#include "lib/pow2.h"
struct io_completion_data {
int nr; /* input */
struct io_completion_data {
int nr; /* input */
@@
-485,7
+486,7
@@
static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u,
~(td->o.verify_interval - 1);
if (!td->o.bs_unaligned && is_power_of_2(minbs))
~(td->o.verify_interval - 1);
if (!td->o.bs_unaligned && is_power_of_2(minbs))
- buflen
= (buflen + minbs - 1) &
~(minbs - 1);
+ buflen
&=
~(minbs - 1);
} while (!io_u_fits(td, io_u, buflen));
} while (!io_u_fits(td, io_u, buflen));
@@
-1896,8
+1897,10
@@
static struct frand_state *get_buf_state(struct thread_data *td)
if (!td->o.dedupe_percentage)
return &td->buf_state;
if (!td->o.dedupe_percentage)
return &td->buf_state;
- else if (td->o.dedupe_percentage == 100)
- return &td->buf_state_prev;
+ else if (td->o.dedupe_percentage == 100) {
+ frand_copy(&td->buf_state_prev, &td->buf_state);
+ return &td->buf_state;
+ }
r = __rand(&td->dedupe_state);
v = 1 + (int) (100.0 * (r / (FRAND_MAX + 1.0)));
r = __rand(&td->dedupe_state);
v = 1 + (int) (100.0 * (r / (FRAND_MAX + 1.0)));
@@
-1910,7
+1913,9
@@
static struct frand_state *get_buf_state(struct thread_data *td)
static void save_buf_state(struct thread_data *td, struct frand_state *rs)
{
static void save_buf_state(struct thread_data *td, struct frand_state *rs)
{
- if (rs == &td->buf_state)
+ if (td->o.dedupe_percentage == 100)
+ frand_copy(rs, &td->buf_state_prev);
+ else if (rs == &td->buf_state)
frand_copy(&td->buf_state_prev, rs);
}
frand_copy(&td->buf_state_prev, rs);
}