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 <chris.mason@oracle.com>
This commit is contained in:
Chris Mason 2008-10-30 11:11:39 -04:00
parent 712c1dea5e
commit 0a7869d69d

View File

@ -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;
extent_buffer_get(eb);
btrfs_cow_block(trans, fs_info->tree_root, eb, NULL, 0, &eb);