X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=trim.c;h=95c433b7c006aa0817357bd6d4b2d94d0d4b68fb;hb=bc769898dee3da9eea5cd64802e54dcfd3256fd5;hp=3da1e749206dc02aaaf633ee25562f3b08c6ee59;hpb=a917a8b3dfeefdd7007ba2f46f21fc145574309d;p=fio.git diff --git a/trim.c b/trim.c index 3da1e749..95c433b7 100644 --- 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); - ipo = flist_entry(td->trim_list.next, struct io_piece, trim_list); + ipo = flist_first_entry(&td->trim_list, struct io_piece, trim_list); remove_trim_entry(td, ipo); io_u->offset = ipo->offset; @@ -70,15 +70,15 @@ 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; - long r; + unsigned long r; 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; + r = __rand(&td->trim_state); + val = (FRAND_MAX / 100ULL); + val *= (unsigned long long) td->o.trim_percentage; return r <= val; } #endif