From: Jens Axboe <axboe@kernel.dk>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: fio@vger.kernel.org, Asias He <asias@redhat.com>
Subject: Re: Why does 'direct' influence 'fsync'?
Date: Sat, 26 Jan 2013 09:28:19 -0700 [thread overview]
Message-ID: <20130126162818.GF15635@kernel.dk> (raw)
In-Reply-To: <20130125114236.GA26765@stefanha-thinkpad.redhat.com>
On Fri, Jan 25 2013, Stefan Hajnoczi wrote:
> Is there a way to flush the disk write cache when O_DIRECT is in use?
>
> It seems that direct=1 causes the fsync setting to be ignored. Asias
> writes:
>
> > The O_DIRECT do affect the flush behaviour. e.g
> >
> > guest$ fio --fsync=100 --direct=1
> > No virtio_blk_handle_flush is observed on host side every 100 IOs
> >
> > guest$ fio --fsync=100 --direct=0
> > virtio_blk_handle_flush is observed on host side every 100 IOs
>
> Am I missing a reason for this behavior? To me it seems weird since you
> could already use --fsync=0 --direct=1 if you want to guarantee that
> fsync is not called. I don't see a need to override the fsync setting.
You are right, fio should not be double guessing options like that. If
you ask for fsync, you should get fsync.
Does the below work for you?
diff --git a/fio.h b/fio.h
index 3a26335..9e20299 100644
--- a/fio.h
+++ b/fio.h
@@ -655,8 +655,6 @@ static inline int should_fsync(struct thread_data *td)
{
if (td->last_was_sync)
return 0;
- if (td->o.odirect)
- return 0;
if (td_write(td) || td_rw(td) || td->o.override_sync)
return 1;
--
Jens Axboe
next prev parent reply other threads:[~2013-01-26 16:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 11:42 Why does 'direct' influence 'fsync'? Stefan Hajnoczi
2013-01-26 16:28 ` Jens Axboe [this message]
2013-01-26 16:51 ` Stefan Hajnoczi
2013-01-27 1:37 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130126162818.GF15635@kernel.dk \
--to=axboe@kernel.dk \
--cc=asias@redhat.com \
--cc=fio@vger.kernel.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox