- if (td->invalidate_cache) {
- if (madvise(f->mmap, f->file_size, MADV_DONTNEED) < 0) {
- td_verror(td, errno);
- return 1;
- }
- }
-
- if (td->sequential) {
- if (madvise(f->mmap, f->file_size, MADV_SEQUENTIAL) < 0) {
- td_verror(td, errno);
- return 1;
- }
- } else {
- if (madvise(f->mmap, f->file_size, MADV_RANDOM) < 0) {
- td_verror(td, errno);
- return 1;
- }
- }
-
- return 0;
-}
-
-static int setup_files_mmap(struct thread_data *td)
-{
- struct fio_file *f;
- int i, err = 0;
-
- for_each_file(td, f, i) {
- err = __setup_file_mmap(td, f);
- if (err)
- break;
- }
-
- return err;
-}
-
-static int __setup_file_plain(struct thread_data *td, struct fio_file *f)
-{
- if (td->invalidate_cache) {
- if (fadvise(f->fd, f->file_offset, f->file_size, POSIX_FADV_DONTNEED) < 0) {
- td_verror(td, errno);
- return 1;
- }
- }
-
- if (td->sequential) {
- if (fadvise(f->fd, f->file_offset, f->file_size, POSIX_FADV_SEQUENTIAL) < 0) {
- td_verror(td, errno);
- return 1;
- }
- } else {
- if (fadvise(f->fd, f->file_offset, f->file_size, POSIX_FADV_RANDOM) < 0) {
- td_verror(td, errno);
- return 1;
- }
- }
-
- return 0;