summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-06-26 16:06:50 +0200
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-06-26 16:06:50 +0200
commit4b52dff6d371b9b93bc99f64c32831ea9a8ec3ac (patch)
tree160a5fb1d8ab8e593775962aedac6ef770da7f3c /fs/btrfs/extent-tree.c
parentBtrfs: Fix mtime and ctime updates on parent dirs (diff)
downloadlinux-4b52dff6d371b9b93bc99f64c32831ea9a8ec3ac.tar.xz
linux-4b52dff6d371b9b93bc99f64c32831ea9a8ec3ac.zip
Btrfs: Fix super block updates during transaction commit
The super block written during commit was not consistent with the state of the trees. This change adds an in-memory copy of the super so that we can make sure to write out consistent data during a commit. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 8025e9f8ef19..7e550343aee7 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -796,8 +796,8 @@ static int finish_current_insert(struct btrfs_trans_handle *trans, struct
for (i = 0; i < extent_root->fs_info->extent_tree_insert_nr; i++) {
ins.objectid = extent_root->fs_info->extent_tree_insert[i];
- super_blocks_used = btrfs_super_blocks_used(info->disk_super);
- btrfs_set_super_blocks_used(info->disk_super,
+ super_blocks_used = btrfs_super_blocks_used(&info->super_copy);
+ btrfs_set_super_blocks_used(&info->super_copy,
super_blocks_used + 1);
ret = btrfs_insert_item(trans, extent_root, &ins, &extent_item,
sizeof(extent_item));
@@ -892,8 +892,8 @@ static int __free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
BUG_ON(ret);
}
- super_blocks_used = btrfs_super_blocks_used(info->disk_super);
- btrfs_set_super_blocks_used(info->disk_super,
+ super_blocks_used = btrfs_super_blocks_used(&info->super_copy);
+ btrfs_set_super_blocks_used(&info->super_copy,
super_blocks_used - num_blocks);
ret = btrfs_del_item(trans, extent_root, path);
if (ret) {
@@ -1032,7 +1032,7 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
info->extent_tree_prealloc_nr = 0;
}
if (search_end == (u64)-1)
- search_end = btrfs_super_total_blocks(info->disk_super);
+ search_end = btrfs_super_total_blocks(&info->super_copy);
if (hint_block) {
block_group = btrfs_lookup_block_group(info, hint_block);
block_group = btrfs_find_block_group(root, block_group,
@@ -1361,8 +1361,8 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
}
}
- super_blocks_used = btrfs_super_blocks_used(info->disk_super);
- btrfs_set_super_blocks_used(info->disk_super, super_blocks_used +
+ super_blocks_used = btrfs_super_blocks_used(&info->super_copy);
+ btrfs_set_super_blocks_used(&info->super_copy, super_blocks_used +
num_blocks);
ret = btrfs_insert_item(trans, extent_root, ins, &extent_item,
sizeof(extent_item));
@@ -1737,7 +1737,7 @@ int btrfs_read_block_groups(struct btrfs_root *root)
BTRFS_BLOCK_GROUP_AVAIL);
}
if (key.objectid >=
- btrfs_super_total_blocks(info->disk_super))
+ btrfs_super_total_blocks(&info->super_copy))
break;
}