diff mbox

[5/5] Btrfs-progs: don't ignore errors in btrfs_add_block_group()

Message ID 1372931320-8340-3-git-send-email-fdmanana@gmail.com (mailing list archive)
State Under Review, archived
Headers show

Commit Message

Filipe Manana July 4, 2013, 9:48 a.m. UTC
This function was not checking if the calls to set_extent_bits()
and set_state_private() actually succeeded or not.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
---
 extent-tree.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/extent-tree.c b/extent-tree.c
index b0cfe0a..d260c14 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -3355,12 +3355,14 @@  btrfs_add_block_group(struct btrfs_fs_info *fs_info, u64 bytes_used, u64 type,
 	BUG_ON(ret);
 
 	bit = block_group_state_bits(type);
-	set_extent_bits(block_group_cache, chunk_offset,
-			chunk_offset + size - 1,
-			bit | EXTENT_LOCKED, GFP_NOFS);
+	ret = set_extent_bits(block_group_cache, chunk_offset,
+			      chunk_offset + size - 1,
+			      bit | EXTENT_LOCKED, GFP_NOFS);
+	BUG_ON(ret);
 
-	set_state_private(block_group_cache, chunk_offset,
-			  (unsigned long)cache);
+	ret = set_state_private(block_group_cache, chunk_offset,
+				(unsigned long)cache);
+	BUG_ON(ret);
 	set_avail_alloc_bits(fs_info, type);
 
 	return cache;