diff options
-rw-r--r-- | fs/btrfs/extent-tree.c | 12 | ||||
-rw-r--r-- | fs/btrfs/file-item.c | 7 | ||||
-rw-r--r-- | fs/btrfs/file.c | 3 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 18 |
4 files changed, 29 insertions, 11 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 71cd456fdb60..aa91773fe31b 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -667,7 +667,9 @@ int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len) | |||
667 | struct btrfs_path *path; | 667 | struct btrfs_path *path; |
668 | 668 | ||
669 | path = btrfs_alloc_path(); | 669 | path = btrfs_alloc_path(); |
670 | BUG_ON(!path); | 670 | if (!path) |
671 | return -ENOMEM; | ||
672 | |||
671 | key.objectid = start; | 673 | key.objectid = start; |
672 | key.offset = len; | 674 | key.offset = len; |
673 | btrfs_set_key_type(&key, BTRFS_EXTENT_ITEM_KEY); | 675 | btrfs_set_key_type(&key, BTRFS_EXTENT_ITEM_KEY); |
@@ -5494,7 +5496,8 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans, | |||
5494 | u32 size = sizeof(*extent_item) + sizeof(*block_info) + sizeof(*iref); | 5496 | u32 size = sizeof(*extent_item) + sizeof(*block_info) + sizeof(*iref); |
5495 | 5497 | ||
5496 | path = btrfs_alloc_path(); | 5498 | path = btrfs_alloc_path(); |
5497 | BUG_ON(!path); | 5499 | if (!path) |
5500 | return -ENOMEM; | ||
5498 | 5501 | ||
5499 | path->leave_spinning = 1; | 5502 | path->leave_spinning = 1; |
5500 | ret = btrfs_insert_empty_item(trans, fs_info->extent_root, path, | 5503 | ret = btrfs_insert_empty_item(trans, fs_info->extent_root, path, |
@@ -7162,7 +7165,10 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, | |||
7162 | spin_unlock(&cluster->refill_lock); | 7165 | spin_unlock(&cluster->refill_lock); |
7163 | 7166 | ||
7164 | path = btrfs_alloc_path(); | 7167 | path = btrfs_alloc_path(); |
7165 | BUG_ON(!path); | 7168 | if (!path) { |
7169 | ret = -ENOMEM; | ||
7170 | goto out; | ||
7171 | } | ||
7166 | 7172 | ||
7167 | inode = lookup_free_space_inode(root, block_group, path); | 7173 | inode = lookup_free_space_inode(root, block_group, path); |
7168 | if (!IS_ERR(inode)) { | 7174 | if (!IS_ERR(inode)) { |
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 90d4ee52cd45..f92ff0ed6e03 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c | |||
@@ -282,7 +282,8 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end, | |||
282 | u16 csum_size = btrfs_super_csum_size(&root->fs_info->super_copy); | 282 | u16 csum_size = btrfs_super_csum_size(&root->fs_info->super_copy); |
283 | 283 | ||
284 | path = btrfs_alloc_path(); | 284 | path = btrfs_alloc_path(); |
285 | BUG_ON(!path); | 285 | if (!path) |
286 | return -ENOMEM; | ||
286 | 287 | ||
287 | if (search_commit) { | 288 | if (search_commit) { |
288 | path->skip_locking = 1; | 289 | path->skip_locking = 1; |
@@ -672,7 +673,9 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, | |||
672 | btrfs_super_csum_size(&root->fs_info->super_copy); | 673 | btrfs_super_csum_size(&root->fs_info->super_copy); |
673 | 674 | ||
674 | path = btrfs_alloc_path(); | 675 | path = btrfs_alloc_path(); |
675 | BUG_ON(!path); | 676 | if (!path) |
677 | return -ENOMEM; | ||
678 | |||
676 | sector_sum = sums->sums; | 679 | sector_sum = sums->sums; |
677 | again: | 680 | again: |
678 | next_offset = (u64)-1; | 681 | next_offset = (u64)-1; |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index fa4ef18b66b1..23d1d811e2b2 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -855,7 +855,8 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, | |||
855 | btrfs_drop_extent_cache(inode, start, end - 1, 0); | 855 | btrfs_drop_extent_cache(inode, start, end - 1, 0); |
856 | 856 | ||
857 | path = btrfs_alloc_path(); | 857 | path = btrfs_alloc_path(); |
858 | BUG_ON(!path); | 858 | if (!path) |
859 | return -ENOMEM; | ||
859 | again: | 860 | again: |
860 | recow = 0; | 861 | recow = 0; |
861 | split = start; | 862 | split = start; |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 3601f0aebddf..8be7d7a759ce 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1070,7 +1070,8 @@ static noinline int run_delalloc_nocow(struct inode *inode, | |||
1070 | u64 ino = btrfs_ino(inode); | 1070 | u64 ino = btrfs_ino(inode); |
1071 | 1071 | ||
1072 | path = btrfs_alloc_path(); | 1072 | path = btrfs_alloc_path(); |
1073 | BUG_ON(!path); | 1073 | if (!path) |
1074 | return -ENOMEM; | ||
1074 | 1075 | ||
1075 | nolock = is_free_space_inode(root, inode); | 1076 | nolock = is_free_space_inode(root, inode); |
1076 | 1077 | ||
@@ -1644,7 +1645,8 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans, | |||
1644 | int ret; | 1645 | int ret; |
1645 | 1646 | ||
1646 | path = btrfs_alloc_path(); | 1647 | path = btrfs_alloc_path(); |
1647 | BUG_ON(!path); | 1648 | if (!path) |
1649 | return -ENOMEM; | ||
1648 | 1650 | ||
1649 | path->leave_spinning = 1; | 1651 | path->leave_spinning = 1; |
1650 | 1652 | ||
@@ -3713,7 +3715,8 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry, | |||
3713 | int ret = 0; | 3715 | int ret = 0; |
3714 | 3716 | ||
3715 | path = btrfs_alloc_path(); | 3717 | path = btrfs_alloc_path(); |
3716 | BUG_ON(!path); | 3718 | if (!path) |
3719 | return -ENOMEM; | ||
3717 | 3720 | ||
3718 | di = btrfs_lookup_dir_item(NULL, root, path, btrfs_ino(dir), name, | 3721 | di = btrfs_lookup_dir_item(NULL, root, path, btrfs_ino(dir), name, |
3719 | namelen, 0); | 3722 | namelen, 0); |
@@ -4438,7 +4441,8 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
4438 | int owner; | 4441 | int owner; |
4439 | 4442 | ||
4440 | path = btrfs_alloc_path(); | 4443 | path = btrfs_alloc_path(); |
4441 | BUG_ON(!path); | 4444 | if (!path) |
4445 | return ERR_PTR(-ENOMEM); | ||
4442 | 4446 | ||
4443 | inode = new_inode(root->fs_info->sb); | 4447 | inode = new_inode(root->fs_info->sb); |
4444 | if (!inode) { | 4448 | if (!inode) { |
@@ -7194,7 +7198,11 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
7194 | goto out_unlock; | 7198 | goto out_unlock; |
7195 | 7199 | ||
7196 | path = btrfs_alloc_path(); | 7200 | path = btrfs_alloc_path(); |
7197 | BUG_ON(!path); | 7201 | if (!path) { |
7202 | err = -ENOMEM; | ||
7203 | drop_inode = 1; | ||
7204 | goto out_unlock; | ||
7205 | } | ||
7198 | key.objectid = btrfs_ino(inode); | 7206 | key.objectid = btrfs_ino(inode); |
7199 | key.offset = 0; | 7207 | key.offset = 0; |
7200 | btrfs_set_key_type(&key, BTRFS_EXTENT_DATA_KEY); | 7208 | btrfs_set_key_type(&key, BTRFS_EXTENT_DATA_KEY); |