All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: always write superblocks synchronously
@ 2017-05-02 16:28 Davidlohr Bueso
  2017-05-03  8:36 ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Davidlohr Bueso @ 2017-05-02 16:28 UTC (permalink / raw)
  To: clm, dsterba
  Cc: jack, dave, linux-btrfs, linux-kernel, stable, Jan Kara, Davidlohr Bueso

Commit b685d3d65ac7 "block: treat REQ_FUA and REQ_PREFLUSH as
synchronous" removed REQ_SYNC flag from WRITE_FUA implementation.
Since REQ_FUA and REQ_FLUSH flags are stripped from submitted IO
when the disk doesn't have volatile write cache and thus effectively
make the write async. This was seen to cause performance hits up
to 90% regression in disk IO related benchmarks such as reaim and
dbench[1].

Fix the problem by making sure the first superblock write is also
treated as synchronous since they can block progress of the
journalling (commit, log syncs) machinery and thus the whole filesystem.

[1] https://www.spinics.net/lists/linux-ext4/msg56238.html

Fixes: b685d3d65ac (block: treat REQ_FUA and REQ_PREFLUSH as synchronous)
Cc: stable <stable@vger.kernel.org>
Cc: Jan Kara <jack@suze.cz>
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 fs/btrfs/disk-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 061c1d1f774f..51b2fd8ceccb 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3468,7 +3468,7 @@ static int write_dev_supers(struct btrfs_device *device,
 		 * to go down lazy.
 		 */
 		if (i == 0)
-			ret = btrfsic_submit_bh(REQ_OP_WRITE, REQ_FUA, bh);
+			ret = btrfsic_submit_bh(REQ_OP_WRITE, REQ_FUA | REQ_SYNC, bh);
 		else
 			ret = btrfsic_submit_bh(REQ_OP_WRITE, REQ_SYNC, bh);
 		if (ret)
-- 
2.12.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: always write superblocks synchronously
  2017-05-02 16:28 [PATCH] btrfs: always write superblocks synchronously Davidlohr Bueso
@ 2017-05-03  8:36 ` Jan Kara
  2017-05-03 14:55   ` Chris Mason
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2017-05-03  8:36 UTC (permalink / raw)
  To: Davidlohr Bueso
  Cc: clm, dsterba, jack, linux-btrfs, linux-kernel, stable, Jan Kara,
	Davidlohr Bueso

On Tue 02-05-17 09:28:13, Davidlohr Bueso wrote:
> Commit b685d3d65ac7 "block: treat REQ_FUA and REQ_PREFLUSH as
> synchronous" removed REQ_SYNC flag from WRITE_FUA implementation.
> Since REQ_FUA and REQ_FLUSH flags are stripped from submitted IO
> when the disk doesn't have volatile write cache and thus effectively
> make the write async. This was seen to cause performance hits up
> to 90% regression in disk IO related benchmarks such as reaim and
> dbench[1].
> 
> Fix the problem by making sure the first superblock write is also
> treated as synchronous since they can block progress of the
> journalling (commit, log syncs) machinery and thus the whole filesystem.
> 
> [1] https://www.spinics.net/lists/linux-ext4/msg56238.html
> 
> Fixes: b685d3d65ac (block: treat REQ_FUA and REQ_PREFLUSH as synchronous)
> Cc: stable <stable@vger.kernel.org>
> Cc: Jan Kara <jack@suze.cz>
> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>

I wasn't patient enough and already sent the fix as part of my series
fixing other filesystems [1]. It also fixes one more place in btrfs that
needs REQ_SYNC to return to the original behavior.

[1] https://www.spinics.net/lists/linux-btrfs/msg65022.html

								Honza

> ---
>  fs/btrfs/disk-io.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 061c1d1f774f..51b2fd8ceccb 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -3468,7 +3468,7 @@ static int write_dev_supers(struct btrfs_device *device,
>  		 * to go down lazy.
>  		 */
>  		if (i == 0)
> -			ret = btrfsic_submit_bh(REQ_OP_WRITE, REQ_FUA, bh);
> +			ret = btrfsic_submit_bh(REQ_OP_WRITE, REQ_FUA | REQ_SYNC, bh);
>  		else
>  			ret = btrfsic_submit_bh(REQ_OP_WRITE, REQ_SYNC, bh);
>  		if (ret)
> -- 
> 2.12.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: always write superblocks synchronously
  2017-05-03  8:36 ` Jan Kara
@ 2017-05-03 14:55   ` Chris Mason
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Mason @ 2017-05-03 14:55 UTC (permalink / raw)
  To: Jan Kara, Davidlohr Bueso
  Cc: dsterba, linux-btrfs, linux-kernel, stable, Jan Kara, Davidlohr Bueso



On 05/03/2017 04:36 AM, Jan Kara wrote:
> On Tue 02-05-17 09:28:13, Davidlohr Bueso wrote:
>> Commit b685d3d65ac7 "block: treat REQ_FUA and REQ_PREFLUSH as
>> synchronous" removed REQ_SYNC flag from WRITE_FUA implementation.
>> Since REQ_FUA and REQ_FLUSH flags are stripped from submitted IO
>> when the disk doesn't have volatile write cache and thus effectively
>> make the write async. This was seen to cause performance hits up
>> to 90% regression in disk IO related benchmarks such as reaim and
>> dbench[1].
>>
>> Fix the problem by making sure the first superblock write is also
>> treated as synchronous since they can block progress of the
>> journalling (commit, log syncs) machinery and thus the whole filesystem.
>>

>>
>> Fixes: b685d3d65ac (block: treat REQ_FUA and REQ_PREFLUSH as synchronous)
>> Cc: stable <stable@vger.kernel.org>
>> Cc: Jan Kara <jack@suze.cz>
>> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
>
> I wasn't patient enough and already sent the fix as part of my series
> fixing other filesystems [1]. It also fixes one more place in btrfs that
> needs REQ_SYNC to return to the original behavior.
>


Thanks guys.

-chris


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-03 14:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-02 16:28 [PATCH] btrfs: always write superblocks synchronously Davidlohr Bueso
2017-05-03  8:36 ` Jan Kara
2017-05-03 14:55   ` Chris Mason

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.