return 0;
}
-static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
- struct btrfs_path *path, int *level,
- struct walk_control *wc)
+static noinline int walk_down_log_tree(struct btrfs_path *path, int *level,
+ struct walk_control *wc)
{
+ struct btrfs_trans_handle *trans = wc->trans;
struct btrfs_fs_info *fs_info = wc->log->fs_info;
u64 bytenr;
u64 ptr_gen;
return 0;
}
-static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
- struct btrfs_path *path, int *level,
- struct walk_control *wc)
+static noinline int walk_up_log_tree(struct btrfs_path *path, int *level,
+ struct walk_control *wc)
{
int i;
int slot;
return ret;
if (wc->free) {
- ret = clean_log_buffer(trans, path->nodes[*level]);
+ ret = clean_log_buffer(wc->trans, path->nodes[*level]);
if (ret)
return ret;
}
* the tree freeing any blocks that have a ref count of zero after being
* decremented.
*/
-static int walk_log_tree(struct btrfs_trans_handle *trans, struct walk_control *wc)
+static int walk_log_tree(struct walk_control *wc)
{
struct btrfs_root *log = wc->log;
int ret = 0;
path->slots[level] = 0;
while (1) {
- wret = walk_down_log_tree(trans, path, &level, wc);
+ wret = walk_down_log_tree(path, &level, wc);
if (wret > 0)
break;
if (wret < 0) {
goto out;
}
- wret = walk_up_log_tree(trans, path, &level, wc);
+ wret = walk_up_log_tree(path, &level, wc);
if (wret > 0)
break;
if (wret < 0) {
if (ret)
goto out;
if (wc->free)
- ret = clean_log_buffer(trans, path->nodes[orig_level]);
+ ret = clean_log_buffer(wc->trans, path->nodes[orig_level]);
}
out:
.free = true,
.process_func = process_one_buffer,
.log = log,
+ .trans = trans,
};
if (log->node) {
- ret = walk_log_tree(trans, &wc);
+ ret = walk_log_tree(&wc);
if (ret) {
/*
* We weren't able to traverse the entire log tree, the
wc.pin = true;
wc.log = log_root_tree;
- ret = walk_log_tree(trans, &wc);
+ ret = walk_log_tree(&wc);
wc.log = NULL;
if (ret) {
btrfs_abort_transaction(trans, ret);
goto next;
}
- ret = walk_log_tree(trans, &wc);
+ ret = walk_log_tree(&wc);
if (ret) {
btrfs_abort_transaction(trans, ret);
goto next;