summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-06-26 10:06:50 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-06-26 10:06:50 -0400
commit4b52dff6d371b9b93bc99f64c32831ea9a8ec3ac (patch)
tree160a5fb1d8ab8e593775962aedac6ef770da7f3c /fs/btrfs/disk-io.c
parent79c44584ea346024e929ac0f2a3577aac33b7b3f (diff)
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/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index d7615e1578c..7081729d5b1 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -471,6 +471,8 @@ struct btrfs_root *open_ctree(struct super_block *sb)
if (!fs_info->sb_buffer)
goto fail_iput;
disk_super = (struct btrfs_super_block *)fs_info->sb_buffer->b_data;
+ fs_info->disk_super = disk_super;
+ memcpy(&fs_info->super_copy, disk_super, sizeof(fs_info->super_copy));
if (!btrfs_super_root(disk_super))
goto fail_sb_buffer;
@@ -479,7 +481,6 @@ struct btrfs_root *open_ctree(struct super_block *sb)
btrfs_super_total_blocks(disk_super) <<
fs_info->btree_inode->i_blkbits);
- fs_info->disk_super = disk_super;
if (strncmp((char *)(&disk_super->magic), BTRFS_MAGIC,
sizeof(disk_super->magic))) {
@@ -527,8 +528,6 @@ int write_ctree_super(struct btrfs_trans_handle *trans, struct btrfs_root
int ret;
struct buffer_head *bh = root->fs_info->sb_buffer;
- btrfs_set_super_root(root->fs_info->disk_super,
- bh_blocknr(root->fs_info->tree_root->node));
lock_buffer(bh);
WARN_ON(atomic_read(&bh->b_count) < 1);
clear_buffer_dirty(bh);