linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Filipe David Borba Manana <fdmanana@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Filipe David Borba Manana <fdmanana@gmail.com>
Subject: [PATCH v2 5/5] Btrfs-progs: don't ignore errors in extent-tree.c
Date: Mon,  8 Jul 2013 14:21:24 +0100	[thread overview]
Message-ID: <1373289684-9441-1-git-send-email-fdmanana@gmail.com> (raw)
In-Reply-To: <1372593106-6593-1-git-send-email-fdmanana@gmail.com>

Several function return values were being completely
ignored.

V2: Added more error checking all over extent-tree.c

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

diff --git a/extent-tree.c b/extent-tree.c
index 6490d8a..6458ce4 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -2110,6 +2110,7 @@ static int finish_current_insert(struct btrfs_trans_handle *trans,
 						extent_op->flags,
 						&extent_op->key,
 						extent_op->level, &key);
+			BUG_ON(ret);
 		} else {
 			BUG_ON(1);
 		}
@@ -2756,7 +2757,7 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
 
 	ret = update_block_group(trans, root, ins->objectid, root->leafsize,
 				 1, 0);
-	return 0;
+	return ret;
 }
 
 static int alloc_tree_block(struct btrfs_trans_handle *trans,
@@ -3345,12 +3346,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;
@@ -3372,8 +3375,11 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans,
 				sizeof(cache->item));
 	BUG_ON(ret);
 
-	finish_current_insert(trans, extent_root);
+	ret = finish_current_insert(trans, extent_root);
+	BUG_ON(ret);
 	ret = del_pending_extents(trans, extent_root);
+	BUG_ON(ret);
+
 	return 0;
 }
 
-- 
1.7.9.5


      parent reply	other threads:[~2013-07-08 13:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-30 11:51 [PATCH 0/3] Small fixes for btrfs-progs Filipe David Borba Manana
2013-06-30 11:51 ` [PATCH 1/3] Btrfs-progs: add missing write check for mkfs Filipe David Borba Manana
2013-07-03 17:09   ` David Sterba
2013-07-03 17:25     ` Filipe David Manana
2013-07-03 21:12       ` David Sterba
2013-06-30 11:51 ` [PATCH 2/3] Btrfs-progs: add kstrdup() return value check Filipe David Borba Manana
2013-06-30 11:51 ` [PATCH 3/3] Btrfs-progs: remove unused code Filipe David Borba Manana
2013-07-01  8:21   ` Anand Jain
2013-07-03 17:30 ` [PATCH v2 1/3] Btrfs-progs: add missing write check for mkfs Filipe David Borba Manana
2013-07-03 17:32 ` [PATCH v2 3/3] Btrfs-progs: remove unused code Filipe David Borba Manana
2013-07-04  9:48 ` [PATCH v2 0/5] Small fixes for btrfs-progs Filipe David Borba Manana
2013-07-04  9:48   ` [PATCH 4/5] Btrfs-progs: return error on write failure in make_btrfs() Filipe David Borba Manana
2013-08-08 10:52     ` Stefan Behrens
2013-08-08 10:56       ` Filipe David Manana
2013-07-04  9:48   ` [PATCH 5/5] Btrfs-progs: don't ignore errors in btrfs_add_block_group() Filipe David Borba Manana
2013-07-08 13:21 ` Filipe David Borba Manana [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373289684-9441-1-git-send-email-fdmanana@gmail.com \
    --to=fdmanana@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).