aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-04-20 13:16:02 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-04-20 13:16:02 -0400
commite66f709b157ee8557166c14b67c01bae978ac32e (patch)
tree69a0c17aaffb173095e105a4680bedbefcb13c84 /fs/btrfs/disk-io.c
parent8fd17795b2261ecb1bad2a6df09ef14c4957a3fb (diff)
Btrfs: write barriers on commit, balance level before split
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index b666c3571aee..13046295bf7a 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -540,6 +540,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
540 fs_info->btree_inode->i_nlink = 1; 540 fs_info->btree_inode->i_nlink = 1;
541 fs_info->btree_inode->i_size = sb->s_bdev->bd_inode->i_size; 541 fs_info->btree_inode->i_size = sb->s_bdev->bd_inode->i_size;
542 fs_info->btree_inode->i_mapping->a_ops = &btree_aops; 542 fs_info->btree_inode->i_mapping->a_ops = &btree_aops;
543 fs_info->do_barriers = 1;
543 BTRFS_I(fs_info->btree_inode)->root = tree_root; 544 BTRFS_I(fs_info->btree_inode)->root = tree_root;
544 memset(&BTRFS_I(fs_info->btree_inode)->location, 0, 545 memset(&BTRFS_I(fs_info->btree_inode)->location, 0,
545 sizeof(struct btrfs_key)); 546 sizeof(struct btrfs_key));
@@ -622,6 +623,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
622int write_ctree_super(struct btrfs_trans_handle *trans, struct btrfs_root 623int write_ctree_super(struct btrfs_trans_handle *trans, struct btrfs_root
623 *root) 624 *root)
624{ 625{
626 int ret;
625 struct buffer_head *bh = root->fs_info->sb_buffer; 627 struct buffer_head *bh = root->fs_info->sb_buffer;
626 628
627 btrfs_set_super_root(root->fs_info->disk_super, 629 btrfs_set_super_root(root->fs_info->disk_super,
@@ -632,7 +634,15 @@ int write_ctree_super(struct btrfs_trans_handle *trans, struct btrfs_root
632 csum_tree_block(root, bh, 0); 634 csum_tree_block(root, bh, 0);
633 bh->b_end_io = end_buffer_write_sync; 635 bh->b_end_io = end_buffer_write_sync;
634 get_bh(bh); 636 get_bh(bh);
635 submit_bh(WRITE, bh); 637 if (root->fs_info->do_barriers)
638 ret = submit_bh(WRITE_BARRIER, bh);
639 else
640 ret = submit_bh(WRITE, bh);
641 if (ret == -EOPNOTSUPP) {
642 set_buffer_uptodate(bh);
643 root->fs_info->do_barriers = 0;
644 ret = submit_bh(WRITE, bh);
645 }
636 wait_on_buffer(bh); 646 wait_on_buffer(bh);
637 if (!buffer_uptodate(bh)) { 647 if (!buffer_uptodate(bh)) {
638 WARN_ON(1); 648 WARN_ON(1);