X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=filesetup.c;h=cb42a852c8cf3728571e54f55103e17d802ef4c4;hb=refs%2Fheads%2Fmaster;hp=8e5059412ed5e82c396d0f87a87523a2e61f1c4c;hpb=5f81856714671287e93e087af8943d3d1779dd5f;p=fio.git diff --git a/filesetup.c b/filesetup.c index 8e505941..cb42a852 100644 --- a/filesetup.c +++ b/filesetup.c @@ -303,13 +303,12 @@ static bool pre_read_file(struct thread_data *td, struct fio_file *f) if (bs > left) bs = left; - b = malloc(bs); + b = calloc(1, bs); if (!b) { td_verror(td, errno, "malloc"); ret = false; goto error; } - memset(b, 0, bs); if (lseek(f->fd, f->file_offset, SEEK_SET) < 0) { td_verror(td, errno, "lseek"); @@ -750,6 +749,11 @@ open_again: if (!read_only) flags |= O_RDWR; + if (td->o.verify_only) { + flags &= ~O_RDWR; + flags |= O_RDONLY; + } + if (f->filetype == FIO_TYPE_FILE && td->o.allow_create) flags |= O_CREAT; @@ -1407,8 +1411,8 @@ done: td_restore_runstate(td, old_state); - if (td->o.fdp) { - err = fdp_init(td); + if (td->o.dp_type != FIO_DP_NONE) { + err = dp_init(td); if (err) goto err_out; } @@ -1448,9 +1452,8 @@ static void __init_rand_distribution(struct thread_data *td, struct fio_file *f) nranges = (fsize + range_size - 1ULL) / range_size; - seed = jhash(f->file_name, strlen(f->file_name), 0) * td->thread_number; - if (!td->o.rand_repeatable) - seed = td->rand_seeds[FIO_RAND_BLOCK_OFF]; + seed = jhash(f->file_name, strlen(f->file_name), 0) * td->thread_number * + td->rand_seeds[FIO_RAND_BLOCK_OFF]; if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) zipf_init(&f->zipf, nranges, td->o.zipf_theta.u.f, td->o.random_center.u.f, seed);