linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Holger Hoffstätte" <holger@applied-asynchrony.com>
To: Christoph Hellwig <hch@infradead.org>, Jan Kara <jack@suse.cz>
Cc: Dave Chinner <david@fromorbit.com>,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-block@vger.kernel.org, hch@lst.de, rdorr@microsoft.com
Subject: Re: [PATCH 4/4] iomap: Use FUA for pure data O_DSYNC DIO writes
Date: Wed, 25 Apr 2018 00:07:07 +0200	[thread overview]
Message-ID: <2fb29b95-a39d-3ee7-249b-86614a8dcbb4@applied-asynchrony.com> (raw)
In-Reply-To: <20180424173444.GA25233@infradead.org>

On 04/24/18 19:34, Christoph Hellwig wrote:
> On Sat, Apr 21, 2018 at 02:54:05PM +0200, Jan Kara wrote:
>>> -		if (iocb->ki_flags & IOCB_DSYNC)
>>> +		if (iocb->ki_flags & IOCB_DSYNC) {
>>>   			dio->flags |= IOMAP_DIO_NEED_SYNC;
>>> +			/*
>>> +			 * We optimistically try using FUA for this IO.  Any
>>> +			 * non-FUA write that occurs will clear this flag, hence
>>> +			 * we know before completion whether a cache flush is
>>> +			 * necessary.
>>> +			 */
>>> +			dio->flags |= IOMAP_DIO_WRITE_FUA;
>>> +		}
>>
>> So I don't think this is quite correct. IOCB_DSYNC gets set also for O_SYNC
>> writes (in that case we also set IOCB_SYNC). And for those we cannot use
>> the FUA optimization AFAICT (definitely IOMAP_F_DIRTY isn't a safe
>> indicator of a need of full fsync for O_SYNC). Other than that the patch
>> looks good to me.
> 
> Oops, good catch. I think the above if should just be
> 
> 		if (iocb->ki_flags & (IOCB_DSYNC | IOCB_SYNC) == IOCB_DSYNC)) {
> 
> and we are fine.

The above line just gives parenthesis salad errors, so why not compromise
on:

	if ((iocb->ki_flags & (IOCB_DSYNC | IOCB_SYNC)) == IOCB_DSYNC) {

Unless my bit twiddling has completely left me I think this is what was
intended, and it actually compiles too.

cheers
Holger

  reply	other threads:[~2018-04-24 22:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18  4:08 [PATCH 0/4 V2] iomap: Use FUA for O_DSYNC DIO writes Dave Chinner
2018-04-18  4:08 ` [PATCH 1/4] xfs: move generic_write_sync calls inwards Dave Chinner
2018-04-18  4:08 ` [PATCH 2/4] iomap: iomap_dio_rw() handles all sync writes Dave Chinner
2018-04-21 13:03   ` Jan Kara
2018-05-02  2:45     ` Dave Chinner
2018-05-02 14:27       ` Robert Dorr
2018-05-03 13:34         ` Jan Kara
2018-05-03 12:51       ` Jan Kara
2018-04-18  4:08 ` [PATCH 3/4] blk: add blk_queue_fua() helper function Dave Chinner
2018-04-18 10:34   ` Christoph Hellwig
2018-04-18 12:18     ` Matthew Wilcox
2018-04-18 14:23   ` Jens Axboe
2018-04-18  4:08 ` [PATCH 4/4] iomap: Use FUA for pure data O_DSYNC DIO writes Dave Chinner
2018-04-21 12:54   ` Jan Kara
2018-04-24 17:34     ` Christoph Hellwig
2018-04-24 22:07       ` Holger Hoffstätte [this message]
2018-04-25  5:20         ` Christoph Hellwig
2018-04-25 13:02         ` Jan Kara
2018-05-02  2:34       ` Dave Chinner

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=2fb29b95-a39d-3ee7-249b-86614a8dcbb4@applied-asynchrony.com \
    --to=holger@applied-asynchrony.com \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=rdorr@microsoft.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;
as well as URLs for NNTP newsgroup(s).