Commit 41ce9970 authored by Wang Shilong's avatar Wang Shilong Committed by Chris Mason

Btrfs: remove transaction from btrfs send

Since daivd did the work that force us to use readonly snapshot,
we can safely remove transaction protection from btrfs send.
Signed-off-by: default avatarWang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent 536cd964
...@@ -4618,7 +4618,6 @@ static int changed_cb(struct btrfs_root *left_root, ...@@ -4618,7 +4618,6 @@ static int changed_cb(struct btrfs_root *left_root,
static int full_send_tree(struct send_ctx *sctx) static int full_send_tree(struct send_ctx *sctx)
{ {
int ret; int ret;
struct btrfs_trans_handle *trans = NULL;
struct btrfs_root *send_root = sctx->send_root; struct btrfs_root *send_root = sctx->send_root;
struct btrfs_key key; struct btrfs_key key;
struct btrfs_key found_key; struct btrfs_key found_key;
...@@ -4640,19 +4639,6 @@ static int full_send_tree(struct send_ctx *sctx) ...@@ -4640,19 +4639,6 @@ static int full_send_tree(struct send_ctx *sctx)
key.type = BTRFS_INODE_ITEM_KEY; key.type = BTRFS_INODE_ITEM_KEY;
key.offset = 0; key.offset = 0;
join_trans:
/*
* We need to make sure the transaction does not get committed
* while we do anything on commit roots. Join a transaction to prevent
* this.
*/
trans = btrfs_join_transaction(send_root);
if (IS_ERR(trans)) {
ret = PTR_ERR(trans);
trans = NULL;
goto out;
}
/* /*
* Make sure the tree has not changed after re-joining. We detect this * Make sure the tree has not changed after re-joining. We detect this
* by comparing start_ctransid and ctransid. They should always match. * by comparing start_ctransid and ctransid. They should always match.
...@@ -4676,19 +4662,6 @@ static int full_send_tree(struct send_ctx *sctx) ...@@ -4676,19 +4662,6 @@ static int full_send_tree(struct send_ctx *sctx)
goto out_finish; goto out_finish;
while (1) { while (1) {
/*
* When someone want to commit while we iterate, end the
* joined transaction and rejoin.
*/
if (btrfs_should_end_transaction(trans, send_root)) {
ret = btrfs_end_transaction(trans, send_root);
trans = NULL;
if (ret < 0)
goto out;
btrfs_release_path(path);
goto join_trans;
}
eb = path->nodes[0]; eb = path->nodes[0];
slot = path->slots[0]; slot = path->slots[0];
btrfs_item_key_to_cpu(eb, &found_key, slot); btrfs_item_key_to_cpu(eb, &found_key, slot);
...@@ -4716,12 +4689,6 @@ static int full_send_tree(struct send_ctx *sctx) ...@@ -4716,12 +4689,6 @@ static int full_send_tree(struct send_ctx *sctx)
out: out:
btrfs_free_path(path); btrfs_free_path(path);
if (trans) {
if (!ret)
ret = btrfs_end_transaction(trans, send_root);
else
btrfs_end_transaction(trans, send_root);
}
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment