diff options
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 86ea471d3801..a6a8159c5d1e 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -5463,7 +5463,8 @@ static int alloc_reserved_file_extent(struct btrfs_trans_handle *trans, | |||
5463 | size = sizeof(*extent_item) + btrfs_extent_inline_ref_size(type); | 5463 | size = sizeof(*extent_item) + btrfs_extent_inline_ref_size(type); |
5464 | 5464 | ||
5465 | path = btrfs_alloc_path(); | 5465 | path = btrfs_alloc_path(); |
5466 | BUG_ON(!path); | 5466 | if (!path) |
5467 | return -ENOMEM; | ||
5467 | 5468 | ||
5468 | path->leave_spinning = 1; | 5469 | path->leave_spinning = 1; |
5469 | ret = btrfs_insert_empty_item(trans, fs_info->extent_root, path, | 5470 | ret = btrfs_insert_empty_item(trans, fs_info->extent_root, path, |
@@ -6457,10 +6458,14 @@ int btrfs_drop_subtree(struct btrfs_trans_handle *trans, | |||
6457 | BUG_ON(root->root_key.objectid != BTRFS_TREE_RELOC_OBJECTID); | 6458 | BUG_ON(root->root_key.objectid != BTRFS_TREE_RELOC_OBJECTID); |
6458 | 6459 | ||
6459 | path = btrfs_alloc_path(); | 6460 | path = btrfs_alloc_path(); |
6460 | BUG_ON(!path); | 6461 | if (!path) |
6462 | return -ENOMEM; | ||
6461 | 6463 | ||
6462 | wc = kzalloc(sizeof(*wc), GFP_NOFS); | 6464 | wc = kzalloc(sizeof(*wc), GFP_NOFS); |
6463 | BUG_ON(!wc); | 6465 | if (!wc) { |
6466 | btrfs_free_path(path); | ||
6467 | return -ENOMEM; | ||
6468 | } | ||
6464 | 6469 | ||
6465 | btrfs_assert_tree_locked(parent); | 6470 | btrfs_assert_tree_locked(parent); |
6466 | parent_level = btrfs_header_level(parent); | 6471 | parent_level = btrfs_header_level(parent); |
@@ -6918,7 +6923,11 @@ static noinline int get_new_locations(struct inode *reloc_inode, | |||
6918 | } | 6923 | } |
6919 | 6924 | ||
6920 | path = btrfs_alloc_path(); | 6925 | path = btrfs_alloc_path(); |
6921 | BUG_ON(!path); | 6926 | if (!path) { |
6927 | if (exts != *extents) | ||
6928 | kfree(exts); | ||
6929 | return -ENOMEM; | ||
6930 | } | ||
6922 | 6931 | ||
6923 | cur_pos = extent_key->objectid - offset; | 6932 | cur_pos = extent_key->objectid - offset; |
6924 | last_byte = extent_key->objectid + extent_key->offset; | 6933 | last_byte = extent_key->objectid + extent_key->offset; |
@@ -7442,7 +7451,8 @@ static noinline int replace_extents_in_leaf(struct btrfs_trans_handle *trans, | |||
7442 | int ret; | 7451 | int ret; |
7443 | 7452 | ||
7444 | new_extent = kmalloc(sizeof(*new_extent), GFP_NOFS); | 7453 | new_extent = kmalloc(sizeof(*new_extent), GFP_NOFS); |
7445 | BUG_ON(!new_extent); | 7454 | if (!new_extent) |
7455 | return -ENOMEM; | ||
7446 | 7456 | ||
7447 | ref = btrfs_lookup_leaf_ref(root, leaf->start); | 7457 | ref = btrfs_lookup_leaf_ref(root, leaf->start); |
7448 | BUG_ON(!ref); | 7458 | BUG_ON(!ref); |
@@ -7647,7 +7657,8 @@ static noinline int init_reloc_tree(struct btrfs_trans_handle *trans, | |||
7647 | return 0; | 7657 | return 0; |
7648 | 7658 | ||
7649 | root_item = kmalloc(sizeof(*root_item), GFP_NOFS); | 7659 | root_item = kmalloc(sizeof(*root_item), GFP_NOFS); |
7650 | BUG_ON(!root_item); | 7660 | if (!root_item) |
7661 | return -ENOMEM; | ||
7651 | 7662 | ||
7652 | ret = btrfs_copy_root(trans, root, root->commit_root, | 7663 | ret = btrfs_copy_root(trans, root, root->commit_root, |
7653 | &eb, BTRFS_TREE_RELOC_OBJECTID); | 7664 | &eb, BTRFS_TREE_RELOC_OBJECTID); |
@@ -7673,7 +7684,7 @@ static noinline int init_reloc_tree(struct btrfs_trans_handle *trans, | |||
7673 | 7684 | ||
7674 | reloc_root = btrfs_read_fs_root_no_radix(root->fs_info->tree_root, | 7685 | reloc_root = btrfs_read_fs_root_no_radix(root->fs_info->tree_root, |
7675 | &root_key); | 7686 | &root_key); |
7676 | BUG_ON(!reloc_root); | 7687 | BUG_ON(IS_ERR(reloc_root)); |
7677 | reloc_root->last_trans = trans->transid; | 7688 | reloc_root->last_trans = trans->transid; |
7678 | reloc_root->commit_root = NULL; | 7689 | reloc_root->commit_root = NULL; |
7679 | reloc_root->ref_tree = &root->fs_info->reloc_ref_tree; | 7690 | reloc_root->ref_tree = &root->fs_info->reloc_ref_tree; |