projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
arch: wire up preadv2/pwritev2 for more architectures
[fio.git]
/
trim.c
diff --git
a/trim.c
b/trim.c
index 3da1e749206dc02aaaf633ee25562f3b08c6ee59..434554129453915515a5b64d47bbed6e914bf765 100644
(file)
--- a/
trim.c
+++ b/
trim.c
@@
-24,7
+24,7
@@
int get_next_trim(struct thread_data *td, struct io_u *io_u)
return 1;
assert(td->trim_entries);
return 1;
assert(td->trim_entries);
- ipo = flist_
entry(td->trim_list.nex
t, struct io_piece, trim_list);
+ ipo = flist_
first_entry(&td->trim_lis
t, struct io_piece, trim_list);
remove_trim_entry(td, ipo);
io_u->offset = ipo->offset;
remove_trim_entry(td, ipo);
io_u->offset = ipo->offset;
@@
-70,15
+70,17
@@
int get_next_trim(struct thread_data *td, struct io_u *io_u)
int io_u_should_trim(struct thread_data *td, struct io_u *io_u)
{
unsigned long long val;
int io_u_should_trim(struct thread_data *td, struct io_u *io_u)
{
unsigned long long val;
- long r;
+ uint64_t frand_max;
+ unsigned long r;
if (!td->o.trim_percentage)
return 0;
if (!td->o.trim_percentage)
return 0;
-
r = os_random_long
(&td->trim_state);
-
val = (OS_RAND_MAX / 100ULL
);
- val
*= (unsigned long long) td->o.trim_percentage
;
+
frand_max = rand_max
(&td->trim_state);
+
r = __rand(&td->trim_state
);
+ val
= (frand_max / 100ULL)
;
+ val *= (unsigned long long) td->o.trim_percentage;
return r <= val;
}
#endif
return r <= val;
}
#endif