btrfs: get fs_info from trans in btrfs_need_log_full_commit
[sfrench/cifs-2.6.git] / fs / btrfs / tree-log.c
index 561884f60d35c36e11928e28e5007901fc695198..dc030f620be1435fc1d7784b33d0415ad3e74cdd 100644 (file)
@@ -139,7 +139,7 @@ static int start_log_trans(struct btrfs_trans_handle *trans,
        mutex_lock(&root->log_mutex);
 
        if (root->log_root) {
-               if (btrfs_need_log_full_commit(fs_info, trans)) {
+               if (btrfs_need_log_full_commit(trans)) {
                        ret = -EAGAIN;
                        goto out;
                }
@@ -225,6 +225,17 @@ void btrfs_end_log_trans(struct btrfs_root *root)
        }
 }
 
+static int btrfs_write_tree_block(struct extent_buffer *buf)
+{
+       return filemap_fdatawrite_range(buf->pages[0]->mapping, buf->start,
+                                       buf->start + buf->len - 1);
+}
+
+static void btrfs_wait_tree_block_writeback(struct extent_buffer *buf)
+{
+       filemap_fdatawait_range(buf->pages[0]->mapping,
+                               buf->start, buf->start + buf->len - 1);
+}
 
 /*
  * the walk control struct is used to pass state down the chain when
@@ -304,7 +315,7 @@ static int process_one_buffer(struct btrfs_root *log,
 
        if (!ret && btrfs_buffer_uptodate(eb, gen, 0)) {
                if (wc->pin && btrfs_header_level(eb) == 0)
-                       ret = btrfs_exclude_logged_extents(fs_info, eb);
+                       ret = btrfs_exclude_logged_extents(eb);
                if (wc->write)
                        btrfs_write_tree_block(eb);
                if (wc->wait)
@@ -2725,7 +2736,7 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
                                if (trans) {
                                        btrfs_tree_lock(next);
                                        btrfs_set_lock_blocking_write(next);
-                                       clean_tree_block(fs_info, next);
+                                       btrfs_clean_tree_block(next);
                                        btrfs_wait_tree_block_writeback(next);
                                        btrfs_tree_unlock(next);
                                } else {
@@ -2809,7 +2820,7 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
                                if (trans) {
                                        btrfs_tree_lock(next);
                                        btrfs_set_lock_blocking_write(next);
-                                       clean_tree_block(fs_info, next);
+                                       btrfs_clean_tree_block(next);
                                        btrfs_wait_tree_block_writeback(next);
                                        btrfs_tree_unlock(next);
                                } else {
@@ -2891,7 +2902,7 @@ static int walk_log_tree(struct btrfs_trans_handle *trans,
                        if (trans) {
                                btrfs_tree_lock(next);
                                btrfs_set_lock_blocking_write(next);
-                               clean_tree_block(fs_info, next);
+                               btrfs_clean_tree_block(next);
                                btrfs_wait_tree_block_writeback(next);
                                btrfs_tree_unlock(next);
                        } else {
@@ -3066,7 +3077,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
        }
 
        /* bail out if we need to do a full commit */
-       if (btrfs_need_log_full_commit(fs_info, trans)) {
+       if (btrfs_need_log_full_commit(trans)) {
                ret = -EAGAIN;
                mutex_unlock(&root->log_mutex);
                goto out;
@@ -3173,7 +3184,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
         * now that we've moved on to the tree of log tree roots,
         * check the full commit flag again
         */
-       if (btrfs_need_log_full_commit(fs_info, trans)) {
+       if (btrfs_need_log_full_commit(trans)) {
                blk_finish_plug(&plug);
                btrfs_wait_tree_log_extents(log, mark);
                mutex_unlock(&log_root_tree->log_mutex);