aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLu Fengqi <lufq.fnst@cn.fujitsu.com>2018-07-31 23:32:30 -0400
committerDavid Sterba <dsterba@suse.com>2018-08-06 07:13:01 -0400
commit401b3b19d592391b718b7a17295ae34eace973dd (patch)
tree355f020d3273f61ab2ab52997daf570b7a367331
parent6025c19fb208e93b99eafc304e7f16160e49fc88 (diff)
btrfs: Remove root parameter from btrfs_unlink_subvol
All callers pass the root tree of dir, we can push that down to the function itself. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/inode.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 407d068d4208..b8c131b82978 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4081,10 +4081,10 @@ out:
4081} 4081}
4082 4082
4083static int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, 4083static int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
4084 struct btrfs_root *root, 4084 struct inode *dir, u64 objectid,
4085 struct inode *dir, u64 objectid, 4085 const char *name, int name_len)
4086 const char *name, int name_len)
4087{ 4086{
4087 struct btrfs_root *root = BTRFS_I(dir)->root;
4088 struct btrfs_path *path; 4088 struct btrfs_path *path;
4089 struct extent_buffer *leaf; 4089 struct extent_buffer *leaf;
4090 struct btrfs_dir_item *di; 4090 struct btrfs_dir_item *di;
@@ -4335,10 +4335,8 @@ int btrfs_delete_subvolume(struct inode *dir, struct dentry *dentry)
4335 4335
4336 btrfs_record_snapshot_destroy(trans, BTRFS_I(dir)); 4336 btrfs_record_snapshot_destroy(trans, BTRFS_I(dir));
4337 4337
4338 ret = btrfs_unlink_subvol(trans, root, dir, 4338 ret = btrfs_unlink_subvol(trans, dir, dest->root_key.objectid,
4339 dest->root_key.objectid, 4339 dentry->d_name.name, dentry->d_name.len);
4340 dentry->d_name.name,
4341 dentry->d_name.len);
4342 if (ret) { 4340 if (ret) {
4343 err = ret; 4341 err = ret;
4344 btrfs_abort_transaction(trans, ret); 4342 btrfs_abort_transaction(trans, ret);
@@ -4433,7 +4431,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
4433 return PTR_ERR(trans); 4431 return PTR_ERR(trans);
4434 4432
4435 if (unlikely(btrfs_ino(BTRFS_I(inode)) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) { 4433 if (unlikely(btrfs_ino(BTRFS_I(inode)) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) {
4436 err = btrfs_unlink_subvol(trans, root, dir, 4434 err = btrfs_unlink_subvol(trans, dir,
4437 BTRFS_I(inode)->location.objectid, 4435 BTRFS_I(inode)->location.objectid,
4438 dentry->d_name.name, 4436 dentry->d_name.name,
4439 dentry->d_name.len); 4437 dentry->d_name.len);
@@ -9505,8 +9503,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
9505 /* src is a subvolume */ 9503 /* src is a subvolume */
9506 if (old_ino == BTRFS_FIRST_FREE_OBJECTID) { 9504 if (old_ino == BTRFS_FIRST_FREE_OBJECTID) {
9507 root_objectid = BTRFS_I(old_inode)->root->root_key.objectid; 9505 root_objectid = BTRFS_I(old_inode)->root->root_key.objectid;
9508 ret = btrfs_unlink_subvol(trans, root, old_dir, 9506 ret = btrfs_unlink_subvol(trans, old_dir, root_objectid,
9509 root_objectid,
9510 old_dentry->d_name.name, 9507 old_dentry->d_name.name,
9511 old_dentry->d_name.len); 9508 old_dentry->d_name.len);
9512 } else { /* src is an inode */ 9509 } else { /* src is an inode */
@@ -9525,8 +9522,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
9525 /* dest is a subvolume */ 9522 /* dest is a subvolume */
9526 if (new_ino == BTRFS_FIRST_FREE_OBJECTID) { 9523 if (new_ino == BTRFS_FIRST_FREE_OBJECTID) {
9527 root_objectid = BTRFS_I(new_inode)->root->root_key.objectid; 9524 root_objectid = BTRFS_I(new_inode)->root->root_key.objectid;
9528 ret = btrfs_unlink_subvol(trans, dest, new_dir, 9525 ret = btrfs_unlink_subvol(trans, new_dir, root_objectid,
9529 root_objectid,
9530 new_dentry->d_name.name, 9526 new_dentry->d_name.name,
9531 new_dentry->d_name.len); 9527 new_dentry->d_name.len);
9532 } else { /* dest is an inode */ 9528 } else { /* dest is an inode */
@@ -9786,7 +9782,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
9786 9782
9787 if (unlikely(old_ino == BTRFS_FIRST_FREE_OBJECTID)) { 9783 if (unlikely(old_ino == BTRFS_FIRST_FREE_OBJECTID)) {
9788 root_objectid = BTRFS_I(old_inode)->root->root_key.objectid; 9784 root_objectid = BTRFS_I(old_inode)->root->root_key.objectid;
9789 ret = btrfs_unlink_subvol(trans, root, old_dir, root_objectid, 9785 ret = btrfs_unlink_subvol(trans, old_dir, root_objectid,
9790 old_dentry->d_name.name, 9786 old_dentry->d_name.name,
9791 old_dentry->d_name.len); 9787 old_dentry->d_name.len);
9792 } else { 9788 } else {
@@ -9808,8 +9804,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
9808 if (unlikely(btrfs_ino(BTRFS_I(new_inode)) == 9804 if (unlikely(btrfs_ino(BTRFS_I(new_inode)) ==
9809 BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) { 9805 BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) {
9810 root_objectid = BTRFS_I(new_inode)->location.objectid; 9806 root_objectid = BTRFS_I(new_inode)->location.objectid;
9811 ret = btrfs_unlink_subvol(trans, dest, new_dir, 9807 ret = btrfs_unlink_subvol(trans, new_dir, root_objectid,
9812 root_objectid,
9813 new_dentry->d_name.name, 9808 new_dentry->d_name.name,
9814 new_dentry->d_name.len); 9809 new_dentry->d_name.len);
9815 BUG_ON(new_inode->i_nlink == 0); 9810 BUG_ON(new_inode->i_nlink == 0);