All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Btrfs: do not backup tree roots when fsync
@ 2017-09-13 18:25 Liu Bo
  2017-09-14  1:55 ` Qu Wenruo
  2017-09-22 23:36 ` [PATCH] Btrfs: use self-explaining variable Liu Bo
  0 siblings, 2 replies; 9+ messages in thread
From: Liu Bo @ 2017-09-13 18:25 UTC (permalink / raw)
  To: linux-btrfs

It doens't make sense to backup tree roots when doing fsync, since
during fsync those tree roots have not been consistent on disk.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/disk-io.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 79ac228..a145a88 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3668,7 +3668,14 @@ int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors)
 	u64 flags;
 
 	do_barriers = !btrfs_test_opt(fs_info, NOBARRIER);
-	backup_super_roots(fs_info);
+
+	/*
+	 * max_mirrors == 0 indicates we're from commit_transaction,
+	 * not from fsync where the tree roots in fs_info have not
+	 * been consistent on disk.
+	 */
+	if (max_mirrors == 0)
+		backup_super_roots(fs_info);
 
 	sb = fs_info->super_for_commit;
 	dev_item = &sb->dev_item;
-- 
2.9.4


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

end of thread, other threads:[~2017-09-24 13:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-13 18:25 [PATCH] Btrfs: do not backup tree roots when fsync Liu Bo
2017-09-14  1:55 ` Qu Wenruo
2017-09-14 12:49   ` David Sterba
2017-09-15 21:09     ` Liu Bo
2017-09-22 23:36 ` [PATCH] Btrfs: use self-explaining variable Liu Bo
2017-09-23  0:46   ` Qu Wenruo
2017-09-23  0:48     ` Liu Bo
2017-09-23  1:09       ` Qu Wenruo
2017-09-24 13:24         ` David Sterba

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.