Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
[pandora-kernel.git] / fs / btrfs / disk-io.c
index 2887b8b..fdce879 100644 (file)
@@ -1550,6 +1550,7 @@ static int transaction_kthread(void *arg)
                spin_unlock(&root->fs_info->new_trans_lock);
 
                trans = btrfs_join_transaction(root, 1);
+               BUG_ON(IS_ERR(trans));
                if (transid == trans->transid) {
                        ret = btrfs_commit_transaction(trans, root);
                        BUG_ON(ret);
@@ -2126,7 +2127,7 @@ static void btrfs_end_buffer_write_sync(struct buffer_head *bh, int uptodate)
        if (uptodate) {
                set_buffer_uptodate(bh);
        } else {
-               if (!buffer_eopnotsupp(bh) && printk_ratelimit()) {
+               if (printk_ratelimit()) {
                        printk(KERN_WARNING "lost page write due to "
                                        "I/O error on %s\n",
                                       bdevname(bh->b_bdev, b));
@@ -2263,21 +2264,10 @@ static int write_dev_supers(struct btrfs_device *device,
                        bh->b_end_io = btrfs_end_buffer_write_sync;
                }
 
-               if (i == last_barrier && do_barriers && device->barriers) {
-                       ret = submit_bh(WRITE_BARRIER, bh);
-                       if (ret == -EOPNOTSUPP) {
-                               printk("btrfs: disabling barriers on dev %s\n",
-                                      device->name);
-                               set_buffer_uptodate(bh);
-                               device->barriers = 0;
-                               /* one reference for submit_bh */
-                               get_bh(bh);
-                               lock_buffer(bh);
-                               ret = submit_bh(WRITE_SYNC, bh);
-                       }
-               } else {
+               if (i == last_barrier && do_barriers)
+                       ret = submit_bh(WRITE_FLUSH_FUA, bh);
+               else
                        ret = submit_bh(WRITE_SYNC, bh);
-               }
 
                if (ret)
                        errors++;
@@ -2464,10 +2454,14 @@ int btrfs_commit_super(struct btrfs_root *root)
        up_write(&root->fs_info->cleanup_work_sem);
 
        trans = btrfs_join_transaction(root, 1);
+       if (IS_ERR(trans))
+               return PTR_ERR(trans);
        ret = btrfs_commit_transaction(trans, root);
        BUG_ON(ret);
        /* run commit again to drop the original snapshot */
        trans = btrfs_join_transaction(root, 1);
+       if (IS_ERR(trans))
+               return PTR_ERR(trans);
        btrfs_commit_transaction(trans, root);
        ret = btrfs_write_and_wait_transaction(NULL, root);
        BUG_ON(ret);