struct btrfs_inode *inode,
int inode_only,
struct btrfs_log_ctx *ctx);
-static int link_to_fixup_dir(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
+static int link_to_fixup_dir(struct walk_control *wc,
struct btrfs_path *path, u64 objectid);
static noinline int replay_dir_deletes(struct walk_control *wc,
struct btrfs_path *path,
return ret;
}
-static int unlink_inode_for_log_replay(struct btrfs_trans_handle *trans,
+static int unlink_inode_for_log_replay(struct walk_control *wc,
struct btrfs_inode *dir,
struct btrfs_inode *inode,
const struct fscrypt_str *name)
{
+ struct btrfs_trans_handle *trans = wc->trans;
int ret;
ret = btrfs_unlink_inode(trans, dir, inode, name);
* This is a helper function to do the unlink of a specific directory
* item
*/
-static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,
+static noinline int drop_one_dir_item(struct walk_control *wc,
struct btrfs_path *path,
struct btrfs_inode *dir,
struct btrfs_dir_item *di)
{
+ struct btrfs_trans_handle *trans = wc->trans;
struct btrfs_root *root = dir->root;
struct btrfs_inode *inode;
struct fscrypt_str name;
goto out;
}
- ret = link_to_fixup_dir(trans, root, path, location.objectid);
+ ret = link_to_fixup_dir(wc, path, location.objectid);
if (ret)
goto out;
- ret = unlink_inode_for_log_replay(trans, dir, inode, &name);
+ ret = unlink_inode_for_log_replay(wc, dir, inode, &name);
out:
kfree(name.name);
if (inode)
inc_nlink(&inode->vfs_inode);
btrfs_release_path(path);
- ret = unlink_inode_for_log_replay(trans, dir, inode, &victim_name);
+ ret = unlink_inode_for_log_replay(wc, dir, inode, &victim_name);
kfree(victim_name.name);
if (ret)
return ret;
inc_nlink(&inode->vfs_inode);
btrfs_release_path(path);
- ret = unlink_inode_for_log_replay(trans, victim_parent, inode,
+ ret = unlink_inode_for_log_replay(wc, victim_parent, inode,
&victim_name);
iput(&victim_parent->vfs_inode);
kfree(victim_name.name);
btrfs_abort_transaction(trans, ret);
return ret;
} else if (di) {
- ret = drop_one_dir_item(trans, path, dir, di);
+ ret = drop_one_dir_item(wc, path, dir, di);
if (ret)
return ret;
}
if (IS_ERR(di)) {
return PTR_ERR(di);
} else if (di) {
- ret = drop_one_dir_item(trans, path, dir, di);
+ ret = drop_one_dir_item(wc, path, dir, di);
if (ret)
return ret;
}
btrfs_abort_transaction(trans, ret);
goto out;
}
- ret = unlink_inode_for_log_replay(trans, dir, inode, &name);
+ ret = unlink_inode_for_log_replay(wc, dir, inode, &name);
kfree(name.name);
iput(&dir->vfs_inode);
if (ret)
* count when replay is done. The link count is incremented here
* so the inode won't go away until we check it
*/
-static noinline int link_to_fixup_dir(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
+static noinline int link_to_fixup_dir(struct walk_control *wc,
struct btrfs_path *path,
u64 objectid)
{
+ struct btrfs_trans_handle *trans = wc->trans;
+ struct btrfs_root *root = wc->root;
struct btrfs_key key;
int ret = 0;
struct btrfs_inode *inode;
return ret;
}
-static int delete_conflicting_dir_entry(struct btrfs_trans_handle *trans,
+static int delete_conflicting_dir_entry(struct walk_control *wc,
struct btrfs_inode *dir,
struct btrfs_path *path,
struct btrfs_dir_item *dst_di,
if (!exists)
return 0;
- return drop_one_dir_item(trans, path, dir, dst_di);
+ return drop_one_dir_item(wc, path, dir, dst_di);
}
/*
btrfs_abort_transaction(trans, ret);
goto out;
} else if (dir_dst_di) {
- ret = delete_conflicting_dir_entry(trans, dir, path, dir_dst_di,
+ ret = delete_conflicting_dir_entry(wc, dir, path, dir_dst_di,
&log_key, log_flags, exists);
if (ret < 0) {
btrfs_abort_transaction(trans, ret);
btrfs_abort_transaction(trans, ret);
goto out;
} else if (index_dst_di) {
- ret = delete_conflicting_dir_entry(trans, dir, path, index_dst_di,
+ ret = delete_conflicting_dir_entry(wc, dir, path, index_dst_di,
&log_key, log_flags, exists);
if (ret < 0) {
btrfs_abort_transaction(trans, ret);
}
btrfs_dir_item_key_to_cpu(eb, di, &di_key);
- ret = link_to_fixup_dir(wc->trans, wc->root, fixup_path, di_key.objectid);
+ ret = link_to_fixup_dir(wc, fixup_path, di_key.objectid);
btrfs_free_path(fixup_path);
}
goto out;
}
- ret = link_to_fixup_dir(trans, root, path, location.objectid);
+ ret = link_to_fixup_dir(wc, path, location.objectid);
if (ret)
goto out;
inc_nlink(&inode->vfs_inode);
- ret = unlink_inode_for_log_replay(trans, dir, inode, &name);
+ ret = unlink_inode_for_log_replay(wc, dir, inode, &name);
/*
* Unlike dir item keys, dir index keys can only have one name (entry) in
* them, as there are no key collisions since each key has a unique offset
break;
}
- ret = link_to_fixup_dir(trans, root, path, key.objectid);
+ ret = link_to_fixup_dir(wc, path, key.objectid);
if (ret)
break;
}