diff --git a/filesetup.c b/filesetup.c index abea1e60b726..e1e48203f660 100644 --- a/filesetup.c +++ b/filesetup.c @@ -395,9 +395,6 @@ static int __file_invalidate_cache(struct thread_data *td, struct fio_file *f, dprint(FD_IO, "invalidate cache %s: %llu/%llu\n", f->file_name, off, len); - /* - * FIXME: add blockdev flushing too - */ if (f->mmap_ptr) { ret = posix_madvise(f->mmap_ptr, f->mmap_sz, POSIX_MADV_DONTNEED); #ifdef FIO_MADV_FREE @@ -419,6 +416,11 @@ static int __file_invalidate_cache(struct thread_data *td, struct fio_file *f, } else if (f->filetype == FIO_TYPE_CHAR || f->filetype == FIO_TYPE_PIPE) ret = 0; + if (ret) { + log_info("fio: cache flush failed: %s\n", strerror(errno)); + ret = 0; + } + if (ret < 0) { td_verror(td, errno, "invalidate_cache"); return 1; @@ -427,7 +429,7 @@ static int __file_invalidate_cache(struct thread_data *td, struct fio_file *f, return 1; } - return ret; + return 0; }