aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2009-01-09 13:14:17 -0500
committerChris Mason <chris.mason@oracle.com>2009-01-09 13:14:17 -0500
commite293e97e363e419d8a3628a927321e3f75206a0b (patch)
tree067fb82bb4cabba35429b28c9e43f9614aea6274 /fs/btrfs/tree-log.c
parent755efdc3c4d3b42d5ffcef0f4d6e5b37ecd3bf21 (diff)
Btrfs: explicitly mark the tree log root for writeback
Each subvolume has an extent_state_tree used to mark metadata that needs to be sent to disk while syncing the tree. This is used in addition to the dirty bits on the pages themselves so that a single subvolume can be sent to disk efficiently in disk order. Normally this marking happens in btrfs_alloc_free_block, which also does special recording of dirty tree blocks for the tree log roots. Yan Zheng noticed that when the root of the log tree is allocated, it is added to the wrong writeback list. The fix used here is to explicitly set it dirty as part of tree log creation. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 332ec35d2c08..d81cda2e077c 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -158,6 +158,19 @@ static int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
158 */ 158 */
159 new_root->ref_cows = 0; 159 new_root->ref_cows = 0;
160 new_root->last_trans = trans->transid; 160 new_root->last_trans = trans->transid;
161
162 /*
163 * we need to make sure the root block for this new tree
164 * is marked as dirty in the dirty_log_pages tree. This
165 * is how it gets flushed down to disk at tree log commit time.
166 *
167 * the tree logging mutex keeps others from coming in and changing
168 * the new_root->node, so we can safely access it here
169 */
170 set_extent_dirty(&new_root->dirty_log_pages, new_root->node->start,
171 new_root->node->start + new_root->node->len - 1,
172 GFP_NOFS);
173
161fail: 174fail:
162 return ret; 175 return ret;
163} 176}