* [PATCH] Always update root items for fs trees at commit time
@ 2009-06-15 13:22 Yan Zheng
2009-06-15 13:26 ` Chris Mason
0 siblings, 1 reply; 2+ messages in thread
From: Yan Zheng @ 2009-06-15 13:22 UTC (permalink / raw)
To: Chris Mason, linux-btrfs
commit_fs_roots skips updating root items for fs trees that aren't modified.
This is unsafe since relocation code modifies root item's last_snapshot field
without modifying corresponding fs tree.
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
---
diff -urp 1/fs/btrfs/transaction.c 2/fs/btrfs/transaction.c
--- 1/fs/btrfs/transaction.c 2009-06-12 21:32:39.812512710 +0800
+++ 2/fs/btrfs/transaction.c 2009-06-15 13:33:56.000000000 +0800
@@ -543,13 +543,13 @@ static noinline int commit_fs_roots(stru
btrfs_free_log(trans, root);
btrfs_update_reloc_root(trans, root);
- if (root->commit_root == root->node)
- continue;
+ if (root->commit_root != root->node) {
+ free_extent_buffer(root->commit_root);
+ root->commit_root = btrfs_root_node(root);
+ btrfs_set_root_node(&root->root_item,
+ root->node);
+ }
- free_extent_buffer(root->commit_root);
- root->commit_root = btrfs_root_node(root);
-
- btrfs_set_root_node(&root->root_item, root->node);
err = btrfs_update_root(trans, fs_info->tree_root,
&root->root_key,
&root->root_item);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] Always update root items for fs trees at commit time
2009-06-15 13:22 [PATCH] Always update root items for fs trees at commit time Yan Zheng
@ 2009-06-15 13:26 ` Chris Mason
0 siblings, 0 replies; 2+ messages in thread
From: Chris Mason @ 2009-06-15 13:26 UTC (permalink / raw)
To: Yan Zheng; +Cc: linux-btrfs
On Mon, Jun 15, 2009 at 09:22:31PM +0800, Yan Zheng wrote:
> commit_fs_roots skips updating root items for fs trees that aren't modified.
> This is unsafe since relocation code modifies root item's last_snapshot field
> without modifying corresponding fs tree.
Thanks for working on these patches.
This could make commit pretty expensive when there are many snapshots in
place that don't get modified. Could you please change the balance code
to mark the root to force writeout?
-chris
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-15 13:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-15 13:22 [PATCH] Always update root items for fs trees at commit time Yan Zheng
2009-06-15 13:26 ` Chris Mason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox