From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from merlin.infradead.org ([205.233.59.134]:56911 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754942Ab3A0BhU (ORCPT ); Sat, 26 Jan 2013 20:37:20 -0500 Date: Sat, 26 Jan 2013 18:37:12 -0700 From: Jens Axboe Subject: Re: Why does 'direct' influence 'fsync'? Message-ID: <20130127013712.GJ15635@kernel.dk> References: <20130125114236.GA26765@stefanha-thinkpad.redhat.com> <20130126162818.GF15635@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: fio-owner@vger.kernel.org List-Id: fio@vger.kernel.org To: Stefan Hajnoczi Cc: fio@vger.kernel.org, Asias He On Sat, Jan 26 2013, Stefan Hajnoczi wrote: > On Sat, Jan 26, 2013 at 5:28 PM, Jens Axboe wrote: > > 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? > > Yes, thanks! > > Tested-by: Stefan Hajnoczi Great, thanks for reporting and testing! -- Jens Axboe