X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=filesetup.c;h=4b0f40d6f9e458071446ab64becf007260188f1e;hb=ae626d4ead6416adf464cf209cdf3e8b85d58190;hp=3cda60630d5d1f54ad1a7fa108b377e1da7c444e;hpb=53bb5d9c037e842970b32bc828dbe809b42c144d;p=fio.git diff --git a/filesetup.c b/filesetup.c index 3cda6063..4b0f40d6 100644 --- a/filesetup.c +++ b/filesetup.c @@ -15,13 +15,12 @@ #include "os/os.h" #include "hash.h" #include "lib/axmap.h" +#include "rwlock.h" #ifdef CONFIG_LINUX_FALLOCATE #include #endif -static int root_warn; - static FLIST_HEAD(filename_list); /* @@ -516,10 +515,9 @@ static int __file_invalidate_cache(struct thread_data *td, struct fio_file *f, ret = blockdev_invalidate_cache(f); } if (ret < 0 && errno == EACCES && geteuid()) { - if (!root_warn) { + if (!fio_did_warn(FIO_WARN_ROOT_FLUSH)) { log_err("fio: only root may flush block " "devices. Cache flush bypassed!\n"); - root_warn = 1; } ret = 0; } @@ -1039,7 +1037,7 @@ int setup_files(struct thread_data *td) if (f->io_size == -1ULL) total_size = -1ULL; else { - if (o->size_percent) { + if (o->size_percent && o->size_percent != 100) { uint64_t file_size; file_size = f->io_size + f->file_offset; @@ -1484,7 +1482,7 @@ static struct fio_file *alloc_new_file(struct thread_data *td) if (td_ioengine_flagged(td, FIO_NOFILEHASH)) f = calloc(1, sizeof(*f)); else - f = smalloc(sizeof(*f)); + f = scalloc(1, sizeof(*f)); if (!f) { assert(0); return NULL;