path: root/disk-io.c
diff options
authorChris Mason <>2008-10-30 11:11:39 -0400
committerChris Mason <>2008-10-30 11:11:39 -0400
commit0a7869d69df44b5993f7c5d6bbf9cce217561aff (patch)
tree5b24849645fe8b48105dcf3a2bc4f2b81dffd99c /disk-io.c
parent712c1dea5e5a7a37b66b94b4a0f21830dd6f69fb (diff)
Avoid tree of tree root cow when committing a clean FS
The root node generation number code made commit_tree_root look like the kernel code. It forces a cow of the tree of tree roots even when the FS hasn't changed. This causes errors during fsck and other readonly operations. This adds a check to see if commit_tree_root is going to trigger writes to the tree of tree roots, and bails if none are pending. Signed-off-by: Chris Mason <>
Diffstat (limited to 'disk-io.c')
1 files changed, 3 insertions, 0 deletions
diff --git a/disk-io.c b/disk-io.c
index 06815728..3caf3a03 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -293,6 +293,9 @@ static int commit_tree_roots(struct btrfs_trans_handle *trans,
struct list_head *next;
struct extent_buffer *eb;
+ if (fs_info->readonly)
+ return 0;
eb = fs_info->tree_root->node;
btrfs_cow_block(trans, fs_info->tree_root, eb, NULL, 0, &eb);