X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=fio.c;h=1248971aca2a75da0fc32074898312ebe0895696;hp=ccf0ad8a4dc24c28262014aabdfb42a174b680b8;hb=2c0ecd28459b6a1b236c865defb5ef76ce8bfa02;hpb=bbfd6b00dea4daee05133c8cb991b78d091df9ae diff --git a/fio.c b/fio.c index ccf0ad8a..1248971a 100644 --- a/fio.c +++ b/fio.c @@ -360,11 +360,11 @@ static int get_rw_ddir(struct thread_data *td) * Check if it's time to seed a new data direction. */ if (elapsed >= td->rwmixcycle) { - unsigned long v; + int v; long r; - r = os_random_long(&td->random_state); - v = 100UL * r / (unsigned long) (RAND_MAX + 1.0); + r = os_random_long(&td->rwmix_state); + v = 1 + (int) (100.0 * (r / (RAND_MAX + 1.0))); if (v < td->rwmixread) td->rwmix_ddir = DDIR_READ; else @@ -933,22 +933,6 @@ static int init_io_u(struct thread_data *td) return 0; } -static void cleanup_allocs(struct thread_data *td) -{ - if (td->directory) - free(td->directory); - if (td->iolog_file) - free(td->iolog_file); - if (td->exec_prerun) - free(td->exec_prerun); - if (td->exec_postrun) - free(td->exec_postrun); - if (td->ioscheduler) - free(td->ioscheduler); - if (td->sysfs_root) - free(td->sysfs_root); -} - static int create_file(struct thread_data *td, unsigned long long size, int extend) { @@ -1189,7 +1173,7 @@ static int setup_file(struct thread_data *td) } if (td->odirect) - flags |= O_DIRECT; + flags |= OS_O_DIRECT; if (td_write(td) || td_rw(td)) { if (td->filetype == FIO_TYPE_FILE) { @@ -1404,7 +1388,6 @@ err: } if (td->mmap) munmap(td->mmap, td->file_size); - cleanup_allocs(td); cleanup_io(td); cleanup_io_u(td); td_set_runstate(td, TD_EXITED);