linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-fsdevel@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 6/7] btrfs: Make flush bios explicitely sync
Date: Tue, 9 May 2017 12:09:00 -0700	[thread overview]
Message-ID: <20170509190900.GD17312@lim.localdomain> (raw)
In-Reply-To: <20170502150351.29452-7-jack@suse.cz>

On Tue, May 02, 2017 at 05:03:50PM +0200, Jan Kara wrote:
> Commit b685d3d65ac7 "block: treat REQ_FUA and REQ_PREFLUSH as
> synchronous" removed REQ_SYNC flag from WRITE_{FUA|PREFLUSH|...}
> definitions.  generic_make_request_checks() however strips REQ_FUA and
> REQ_PREFLUSH flags from a bio when the storage doesn't report volatile
> write cache and thus write effectively becomes asynchronous which can
> lead to performance regressions
> 
> Fix the problem by making sure all bios which are synchronous are
> properly marked with REQ_SYNC.
>

Reviewed-by: Liu Bo <bo.li.liu@oracle.com>

Thanks,

-liubo
> CC: David Sterba <dsterba@suse.com>
> CC: linux-btrfs@vger.kernel.org
> Fixes: b685d3d65ac791406e0dfd8779cc9b3707fea5a3
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/btrfs/disk-io.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index eb1ee7b6f532..af75a9aab81e 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -3488,10 +3488,12 @@ static int write_dev_supers(struct btrfs_device *device,
>  		 * we fua the first super.  The others we allow
>  		 * to go down lazy.
>  		 */
> -		if (i == 0)
> -			ret = btrfsic_submit_bh(REQ_OP_WRITE, REQ_FUA, bh);
> -		else
> +		if (i == 0) {
> +			ret = btrfsic_submit_bh(REQ_OP_WRITE,
> +						REQ_SYNC | REQ_FUA, bh);
> +		} else {
>  			ret = btrfsic_submit_bh(REQ_OP_WRITE, REQ_SYNC, bh);
> +		}
>  		if (ret)
>  			errors++;
>  	}
> @@ -3555,7 +3557,7 @@ static int write_dev_flush(struct btrfs_device *device, int wait)
>  
>  	bio->bi_end_io = btrfs_end_empty_barrier;
>  	bio->bi_bdev = device->bdev;
> -	bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH;
> +	bio->bi_opf = REQ_OP_WRITE | REQ_SYNC | REQ_PREFLUSH;
>  	init_completion(&device->flush_wait);
>  	bio->bi_private = &device->flush_wait;
>  	device->flush_bio = bio;
> -- 
> 2.12.0
> 

  parent reply	other threads:[~2017-05-09 19:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02 15:03 [PATCH 0/7] Fix fallout from changes to FUA and PREFLUSH definitions Jan Kara
2017-05-02 15:03 ` [PATCH 1/7] ext4: Mark superblock writes synchronous for nobarrier mounts Jan Kara
2017-05-04 15:00   ` Theodore Ts'o
2017-05-02 15:03 ` [PATCH 2/7] jbd2: Cleanup write flags handling from jbd2_write_superblock() Jan Kara
2017-05-04 15:00   ` Theodore Ts'o
2017-05-02 15:03 ` [PATCH 3/7] f2fs: Make flush bios explicitely sync Jan Kara
2017-05-03 16:20   ` [f2fs-dev] " Chao Yu
2017-05-03 21:22   ` Jaegeuk Kim
2017-05-04  7:32     ` Jan Kara
2017-05-04  7:34       ` Jan Kara
2017-05-04  7:36         ` Jaegeuk Kim
2017-05-02 15:03 ` [PATCH 4/7] gfs2: " Jan Kara
2017-05-02 15:44   ` Bob Peterson
2017-05-02 15:03 ` [PATCH 5/7] reiserfs: " Jan Kara
2017-05-02 15:03 ` [PATCH 6/7] btrfs: " Jan Kara
2017-05-02 15:38   ` David Sterba
2017-05-09 19:09   ` Liu Bo [this message]
2017-05-02 15:03 ` [PATCH 7/7] md: " Jan Kara

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=20170509190900.GD17312@lim.localdomain \
    --to=bo.li.liu@oracle.com \
    --cc=dsterba@suse.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /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).