From c009cdac4bfc2ef741e6ac3324f766fd9e6e3f29 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 18 Nov 2005 11:01:35 +0100 Subject: [PATCH] [PATCH] fio: for mmap'ed io with the direct option, sync after each copy --- fio.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fio.c b/fio.c index baf50f4..c46b5ac 100644 --- a/fio.c +++ b/fio.c @@ -700,6 +700,14 @@ static int __do_sync_mmap(struct thread_data *td, struct io_u *io_u) memcpy(io_u->buf, td->mmap + real_off, io_u->buflen); else memcpy(td->mmap + real_off, io_u->buf, io_u->buflen); + + /* + * not really direct, but should drop the pages from the cache + */ + if (td->odirect) { + msync(td->mmap + real_off, io_u->buflen, MS_SYNC); + madvise(td->mmap + real_off, io_u->buflen, MADV_DONTNEED); + } return io_u->buflen; } -- 2.25.1