From: Jens Axboe Date: Thu, 10 Apr 2014 14:59:43 +0000 (-0600) Subject: Make cache invalidation a soft error X-Git-Tag: fio-2.1.8~3 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=dfe11fd1e8249a52c42f34c9e9e6b910ab6b05c5;hp=81795ce399bef3af497e5767546458e20ce81bbf;ds=inline Make cache invalidation a soft error On some platforms, we don't have reliable means of flushing eg block device caches. Just warn of this fact instead of erroring out, since the user can't do anything to stop this. Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index abea1e60..1c529792 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,15 +416,18 @@ 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 < 0) { - td_verror(td, errno, "invalidate_cache"); - return 1; - } else if (ret > 0) { - td_verror(td, ret, "invalidate_cache"); - return 1; + /* + * Cache flushing isn't a fatal condition, and we know it will + * happen on some platforms where we don't have the proper + * function to flush eg block device caches. So just warn and + * continue on our way. + */ + if (ret) { + log_info("fio: cache invalidation of %s failed: %s\n", f->file_name, strerror(errno)); + ret = 0; } - return ret; + return 0; }