diff mbox series

[v2,06/10] btrfs-progs: make sure track_dirty and ref_cows is set properly

Message ID ce8c770705df22993bdcd9adc3e6004734e4a940.1629749291.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: mkfs fixes and prep work for extent tree v2 | expand

Commit Message

Josef Bacik Aug. 23, 2021, 8:14 p.m. UTC
Adding support for the per-block group roots means we will be reading
the roots directly in different places.  Make sure we set ->track_dirty
and ->ref_cows properly in the helper so we don't have to do this
everywhere.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 kernel-shared/disk-io.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel-shared/disk-io.c b/kernel-shared/disk-io.c
index 84990a52..7f99fc8d 100644
--- a/kernel-shared/disk-io.c
+++ b/kernel-shared/disk-io.c
@@ -720,7 +720,10 @@  out:
 		return ERR_PTR(-EIO);
 	}
 insert:
-	root->ref_cows = 1;
+	if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID)
+		root->track_dirty = 1;
+	if (is_fstree(root->root_key.objectid))
+		root->ref_cows = 1;
 	return root;
 }