diff options
author | Jeff Mahoney <jeffm@suse.com> | 2012-03-01 11:24:58 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2012-03-21 20:45:40 -0400 |
commit | 49b25e0540904be0bf558b84475c69d72e4de66e (patch) | |
tree | 5a89b2f5d6e5bd8b1ff39bdb387071ec1cb2a615 /fs/btrfs/relocation.c | |
parent | 4da35113426d16673aa1fb0613c14ca2e419e7fd (diff) |
btrfs: enhance transaction abort infrastructure
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r-- | fs/btrfs/relocation.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index a87678ead611..cba7a0bf3667 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -4410,7 +4410,7 @@ void btrfs_reloc_pre_snapshot(struct btrfs_trans_handle *trans, | |||
4410 | * called after snapshot is created. migrate block reservation | 4410 | * called after snapshot is created. migrate block reservation |
4411 | * and create reloc root for the newly created snapshot | 4411 | * and create reloc root for the newly created snapshot |
4412 | */ | 4412 | */ |
4413 | void btrfs_reloc_post_snapshot(struct btrfs_trans_handle *trans, | 4413 | int btrfs_reloc_post_snapshot(struct btrfs_trans_handle *trans, |
4414 | struct btrfs_pending_snapshot *pending) | 4414 | struct btrfs_pending_snapshot *pending) |
4415 | { | 4415 | { |
4416 | struct btrfs_root *root = pending->root; | 4416 | struct btrfs_root *root = pending->root; |
@@ -4420,7 +4420,7 @@ void btrfs_reloc_post_snapshot(struct btrfs_trans_handle *trans, | |||
4420 | int ret; | 4420 | int ret; |
4421 | 4421 | ||
4422 | if (!root->reloc_root) | 4422 | if (!root->reloc_root) |
4423 | return; | 4423 | return 0; |
4424 | 4424 | ||
4425 | rc = root->fs_info->reloc_ctl; | 4425 | rc = root->fs_info->reloc_ctl; |
4426 | rc->merging_rsv_size += rc->nodes_relocated; | 4426 | rc->merging_rsv_size += rc->nodes_relocated; |
@@ -4429,19 +4429,21 @@ void btrfs_reloc_post_snapshot(struct btrfs_trans_handle *trans, | |||
4429 | ret = btrfs_block_rsv_migrate(&pending->block_rsv, | 4429 | ret = btrfs_block_rsv_migrate(&pending->block_rsv, |
4430 | rc->block_rsv, | 4430 | rc->block_rsv, |
4431 | rc->nodes_relocated); | 4431 | rc->nodes_relocated); |
4432 | BUG_ON(ret); | 4432 | if (ret) |
4433 | return ret; | ||
4433 | } | 4434 | } |
4434 | 4435 | ||
4435 | new_root = pending->snap; | 4436 | new_root = pending->snap; |
4436 | reloc_root = create_reloc_root(trans, root->reloc_root, | 4437 | reloc_root = create_reloc_root(trans, root->reloc_root, |
4437 | new_root->root_key.objectid); | 4438 | new_root->root_key.objectid); |
4439 | if (IS_ERR(reloc_root)) | ||
4440 | return PTR_ERR(reloc_root); | ||
4438 | 4441 | ||
4439 | ret = __add_reloc_root(reloc_root); | 4442 | ret = __add_reloc_root(reloc_root); |
4440 | BUG_ON(ret < 0); | 4443 | BUG_ON(ret < 0); |
4441 | new_root->reloc_root = reloc_root; | 4444 | new_root->reloc_root = reloc_root; |
4442 | 4445 | ||
4443 | if (rc->create_reloc_tree) { | 4446 | if (rc->create_reloc_tree) |
4444 | ret = clone_backref_node(trans, rc, root, reloc_root); | 4447 | ret = clone_backref_node(trans, rc, root, reloc_root); |
4445 | BUG_ON(ret); | 4448 | return ret; |
4446 | } | ||
4447 | } | 4449 | } |