From: Jens Axboe Date: Mon, 26 Feb 2007 11:57:32 +0000 (+0100) Subject: Merge branch 'master' of ssh://brick.kernel.dk/data/git/fio X-Git-Tag: fio-1.12~5 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=c6441dc9e95cba2a31dec63272917fdf496c75c4;hp=cb5ab5121ac4fa62e0ca2612b359f19bfdd30f29 Merge branch 'master' of ssh://brick.kernel.dk/data/git/fio --- diff --git a/filesetup.c b/filesetup.c index 356580e7..d8135ef0 100644 --- a/filesetup.c +++ b/filesetup.c @@ -239,11 +239,13 @@ int file_invalidate_cache(struct thread_data *td, struct fio_file *f) */ if (td->io_ops->flags & FIO_MMAPIO) ret = madvise(f->mmap, f->file_size, MADV_DONTNEED); - else if (td->filetype == FIO_TYPE_FILE) - ret = fadvise(f->fd, f->file_offset, f->file_size, POSIX_FADV_DONTNEED); - else if (td->filetype == FIO_TYPE_BD) - ret = blockdev_invalidate_cache(f->fd); - else if (td->filetype == FIO_TYPE_CHAR) + else if (td->filetype == FIO_TYPE_FILE) { + if (!td->odirect) + ret = fadvise(f->fd, f->file_offset, f->file_size, POSIX_FADV_DONTNEED); + } else if (td->filetype == FIO_TYPE_BD) { + if (!td->odirect) + ret = blockdev_invalidate_cache(f->fd); + } else if (td->filetype == FIO_TYPE_CHAR) ret = 0; if (ret < 0) { @@ -251,7 +253,7 @@ int file_invalidate_cache(struct thread_data *td, struct fio_file *f) return 1; } - return 0; + return ret; } static int __setup_file_mmap(struct thread_data *td, struct fio_file *f)