btrfs: Remove fs_info argument from btrfs_trans_release_metadata
[sfrench/cifs-2.6.git] / fs / btrfs / transaction.c
index beca2563578722615afeb3a7e287fd4c0b9b969a..bfbc1ace2a247d8b9738a52c817b5018781bb01d 100644 (file)
@@ -818,9 +818,11 @@ int btrfs_should_end_transaction(struct btrfs_trans_handle *trans)
        return should_end_transaction(trans);
 }
 
-static void btrfs_trans_release_metadata(struct btrfs_trans_handle *trans,
-                                 struct btrfs_fs_info *fs_info)
+static void btrfs_trans_release_metadata(struct btrfs_trans_handle *trans)
+
 {
+       struct btrfs_fs_info *fs_info = trans->fs_info;
+
        if (!trans->block_rsv) {
                ASSERT(!trans->bytes_reserved);
                return;
@@ -854,7 +856,7 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
                return 0;
        }
 
-       btrfs_trans_release_metadata(trans, info);
+       btrfs_trans_release_metadata(trans);
        trans->block_rsv = NULL;
 
        if (!list_empty(&trans->new_bgs))
@@ -875,7 +877,7 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
                        must_run_delayed_refs = 2;
        }
 
-       btrfs_trans_release_metadata(trans, info);
+       btrfs_trans_release_metadata(trans);
        trans->block_rsv = NULL;
 
        if (!list_empty(&trans->new_bgs))
@@ -1083,40 +1085,33 @@ int btrfs_wait_tree_log_extents(struct btrfs_root *log_root, int mark)
 }
 
 /*
- * when btree blocks are allocated, they have some corresponding bits set for
- * them in one of two extent_io trees.  This is used to make sure all of
- * those extents are on disk for transaction or log commit
+ * When btree blocks are allocated the corresponding extents are marked dirty.
+ * This function ensures such extents are persisted on disk for transaction or
+ * log commit.
+ *
+ * @trans: transaction whose dirty pages we'd like to write
  */
-static int btrfs_write_and_wait_marked_extents(struct btrfs_fs_info *fs_info,
-                               struct extent_io_tree *dirty_pages, int mark)
+static int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,
+                                           struct btrfs_fs_info *fs_info)
 {
        int ret;
        int ret2;
+       struct extent_io_tree *dirty_pages = &trans->transaction->dirty_pages;
        struct blk_plug plug;
 
        blk_start_plug(&plug);
-       ret = btrfs_write_marked_extents(fs_info, dirty_pages, mark);
+       ret = btrfs_write_marked_extents(fs_info, dirty_pages, EXTENT_DIRTY);
        blk_finish_plug(&plug);
        ret2 = btrfs_wait_extents(fs_info, dirty_pages);
 
+       clear_btree_io_tree(&trans->transaction->dirty_pages);
+
        if (ret)
                return ret;
-       if (ret2)
+       else if (ret2)
                return ret2;
-       return 0;
-}
-
-static int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,
-                                           struct btrfs_fs_info *fs_info)
-{
-       int ret;
-
-       ret = btrfs_write_and_wait_marked_extents(fs_info,
-                                          &trans->transaction->dirty_pages,
-                                          EXTENT_DIRTY);
-       clear_btree_io_tree(&trans->transaction->dirty_pages);
-
-       return ret;
+       else
+               return 0;
 }
 
 /*
@@ -1976,7 +1971,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
                return ret;
        }
 
-       btrfs_trans_release_metadata(trans, fs_info);
+       btrfs_trans_release_metadata(trans);
        trans->block_rsv = NULL;
 
        cur_trans = trans->transaction;
@@ -2330,7 +2325,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
 scrub_continue:
        btrfs_scrub_continue(fs_info);
 cleanup_transaction:
-       btrfs_trans_release_metadata(trans, fs_info);
+       btrfs_trans_release_metadata(trans);
        btrfs_trans_release_chunk_metadata(trans);
        trans->block_rsv = NULL;
        btrfs_warn(fs_info, "Skipping commit of aborted transaction.");