filesetup: don't round/adjust size for size_percent == 100
[fio.git] / filesetup.c
index 30af085d0b33e3eb4ee6fd490fee0a01018d368b..dd8f6eb2b0f67660d56582142f81ba64a98a825d 100644 (file)
@@ -20,8 +20,6 @@
 #include <linux/falloc.h>
 #endif
 
-static int root_warn;
-
 static FLIST_HEAD(filename_list);
 
 /*
@@ -490,6 +488,10 @@ static int __file_invalidate_cache(struct thread_data *td, struct fio_file *f,
                ret = td->io_ops->invalidate(td, f);
                if (ret < 0)
                        errval = -ret;
+       } else if (td_ioengine_flagged(td, FIO_DISKLESSIO)) {
+               dprint(FD_IO, "invalidate not supported by ioengine %s\n",
+                      td->io_ops->name);
+               ret = 0;
        } else if (f->filetype == FIO_TYPE_FILE) {
                dprint(FD_IO, "declare unneeded cache %s: %llu/%llu\n",
                        f->file_name, off, len);
@@ -512,10 +514,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;
                }
@@ -1035,7 +1036,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;