aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2013-02-28 05:01:15 -0500
committerJosef Bacik <jbacik@fusionio.com>2013-02-28 13:33:53 -0500
commite9662f701c85ebc99f532bf8bb53208c0648846a (patch)
treef72d77f7bdea310bc25e70dc71b292dd4d3d287b /fs/btrfs/transaction.c
parent2d8946c59743bc635a5e5701e6ef8e71e0a16ab7 (diff)
Btrfs: remove unnecessary dget_parent/dput when creating the pending snapshot
Since we have grabbed the parent inode at the beginning of the snapshot creation, and both sync and async snapshot creation release it after the pending snapshots are actually created, it is safe to access the parent inode directly during the snapshot creation, we needn't use dget_parent/dput to fix the parent dentry and get the dir inode. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 3733c4939a27..71de435a291e 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1068,7 +1068,6 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1068 struct inode *parent_inode; 1068 struct inode *parent_inode;
1069 struct btrfs_path *path; 1069 struct btrfs_path *path;
1070 struct btrfs_dir_item *dir_item; 1070 struct btrfs_dir_item *dir_item;
1071 struct dentry *parent;
1072 struct dentry *dentry; 1071 struct dentry *dentry;
1073 struct extent_buffer *tmp; 1072 struct extent_buffer *tmp;
1074 struct extent_buffer *old; 1073 struct extent_buffer *old;
@@ -1126,8 +1125,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1126 trans->bytes_reserved = trans->block_rsv->reserved; 1125 trans->bytes_reserved = trans->block_rsv->reserved;
1127 1126
1128 dentry = pending->dentry; 1127 dentry = pending->dentry;
1129 parent = dget_parent(dentry); 1128 parent_inode = pending->dir;
1130 parent_inode = parent->d_inode;
1131 parent_root = BTRFS_I(parent_inode)->root; 1129 parent_root = BTRFS_I(parent_inode)->root;
1132 record_root_in_trans(trans, parent_root); 1130 record_root_in_trans(trans, parent_root);
1133 1131
@@ -1275,7 +1273,6 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1275 if (ret) 1273 if (ret)
1276 btrfs_abort_transaction(trans, root, ret); 1274 btrfs_abort_transaction(trans, root, ret);
1277fail: 1275fail:
1278 dput(parent);
1279 trans->block_rsv = rsv; 1276 trans->block_rsv = rsv;
1280 trans->bytes_reserved = 0; 1277 trans->bytes_reserved = 0;
1281no_free_objectid: 1278no_free_objectid: