linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Mahoney <jeffm@suse.com>
To: BtrFS List <linux-btrfs@vger.kernel.org>
Cc: Chris Mason <chris.mason@oracle.com>
Subject: [patch 57/65] btrfs: btrfs_free_extent void return prep
Date: Mon, 03 Oct 2011 23:23:27 -0400	[thread overview]
Message-ID: <20111004032306.448444830@suse.com> (raw)
In-Reply-To: 20111004032230.458853274@suse.com

 btrfs_free_extent has no error conditions, but is used via process_func
 in __btrfs_mod_ref which requires it to return an int.

 This patch cleans up the callers to eliminate error handling that will
 never be used. The next patch makes both btrfs_free_extent and the other
 function used via process_func, btrfs_inc_extent_ref, return void.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/btrfs/extent-tree.c |    8 +++-----
 fs/btrfs/file.c        |   23 +++++++++--------------
 fs/btrfs/inode.c       |    9 ++++-----
 fs/btrfs/relocation.c  |   23 +++++++++--------------
 4 files changed, 25 insertions(+), 38 deletions(-)

--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4765,13 +4765,12 @@ int btrfs_free_extent(struct btrfs_trans
 		      u64 bytenr, u64 num_bytes, u64 parent,
 		      u64 root_objectid, u64 owner, u64 offset)
 {
-	int ret;
-
 	/*
 	 * tree log blocks never actually go into the extent allocation
 	 * tree, just update pinning info and exit early.
 	 */
 	if (root_objectid == BTRFS_TREE_LOG_OBJECTID) {
+		int ret;
 		WARN_ON(owner >= BTRFS_FIRST_FREE_OBJECTID);
 		/* unlocks the pinned mutex */
 		ret = btrfs_pin_extent(root, bytenr, num_bytes, 1);
@@ -6106,9 +6105,8 @@ skip:
 			parent = 0;
 		}
 
-		ret = btrfs_free_extent(trans, root, bytenr, blocksize, parent,
-					root->root_key.objectid, level - 1, 0);
-		BUG_ON(ret);
+		btrfs_free_extent(trans, root, bytenr, blocksize, parent,
+				  root->root_key.objectid, level - 1, 0);
 	}
 	btrfs_tree_unlock(next);
 	free_extent_buffer(next);
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -747,12 +747,11 @@ next_slot:
 				extent_end = ALIGN(extent_end,
 						   root->sectorsize);
 			} else if (disk_bytenr > 0) {
-				ret = btrfs_free_extent(trans, root,
-						disk_bytenr, num_bytes, 0,
-						root->root_key.objectid,
-						key.objectid, key.offset -
-						extent_offset);
-				BUG_ON(ret);
+				btrfs_free_extent(trans, root,
+						  disk_bytenr, num_bytes, 0,
+						  root->root_key.objectid,
+						  key.objectid, key.offset -
+						  extent_offset);
 				inode_sub_bytes(inode,
 						extent_end - key.offset);
 				*hint_byte = disk_bytenr;
@@ -984,10 +983,8 @@ again:
 		extent_end = other_end;
 		del_slot = path->slots[0] + 1;
 		del_nr++;
-		ret = btrfs_free_extent(trans, root, bytenr, num_bytes,
-					0, root->root_key.objectid,
-					ino, orig_offset);
-		BUG_ON(ret);
+		btrfs_free_extent(trans, root, bytenr, num_bytes, 0,
+				  root->root_key.objectid, ino, orig_offset);
 	}
 	other_start = 0;
 	other_end = start;
@@ -1001,10 +998,8 @@ again:
 		key.offset = other_start;
 		del_slot = path->slots[0];
 		del_nr++;
-		ret = btrfs_free_extent(trans, root, bytenr, num_bytes,
-					0, root->root_key.objectid,
-					ino, orig_offset);
-		BUG_ON(ret);
+		btrfs_free_extent(trans, root, bytenr, num_bytes, 0,
+				  root->root_key.objectid, ino, orig_offset);
 	}
 	if (del_nr == 0) {
 		fi = btrfs_item_ptr(leaf, path->slots[0],
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3340,11 +3340,10 @@ delete:
 		if (found_extent && (root->ref_cows ||
 				     root == root->fs_info->tree_root)) {
 			btrfs_set_path_blocking(path);
-			ret = btrfs_free_extent(trans, root, extent_start,
-						extent_num_bytes, 0,
-						btrfs_header_owner(leaf),
-						ino, extent_offset);
-			BUG_ON(ret);
+			btrfs_free_extent(trans, root, extent_start,
+					  extent_num_bytes, 0,
+					  btrfs_header_owner(leaf),
+					  ino, extent_offset);
 		}
 
 		if (found_type == BTRFS_INODE_ITEM_KEY)
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1612,10 +1612,9 @@ int replace_file_extents(struct btrfs_tr
 				     btrfs_header_owner(leaf),
 				     key.objectid, key.offset);
 
-		ret = btrfs_free_extent(trans, root, bytenr, num_bytes,
-					parent, btrfs_header_owner(leaf),
-					key.objectid, key.offset);
-		BUG_ON(ret);
+		btrfs_free_extent(trans, root, bytenr, num_bytes,
+				  parent, btrfs_header_owner(leaf),
+				  key.objectid, key.offset);
 	}
 	if (dirty)
 		btrfs_mark_buffer_dirty(leaf);
@@ -1786,16 +1785,12 @@ again:
 				     src->root_key.objectid, level - 1, 0);
 		btrfs_inc_extent_ref(trans, dest, new_bytenr, blocksize,
 				     0, dest->root_key.objectid, level - 1, 0);
-		ret = btrfs_free_extent(trans, src, new_bytenr, blocksize,
-					path->nodes[level]->start,
-					src->root_key.objectid, level - 1, 0);
-		BUG_ON(ret);
-
-		ret = btrfs_free_extent(trans, dest, old_bytenr, blocksize,
-					0, dest->root_key.objectid, level - 1,
-					0);
-		BUG_ON(ret);
-
+		btrfs_free_extent(trans, src, new_bytenr, blocksize,
+				  path->nodes[level]->start,
+				  src->root_key.objectid, level - 1, 0);
+		btrfs_free_extent(trans, dest, old_bytenr, blocksize,
+				  0, dest->root_key.objectid, level - 1,
+				  0);
 		btrfs_unlock_up_safe(path, 0);
 
 		ret = level;




  parent reply	other threads:[~2011-10-04  3:23 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-04  3:22 [patch 00/65] Error handling patchset v3 Jeff Mahoney
2011-10-04  3:22 ` [patch 01/65] btrfs: Add btrfs_panic() Jeff Mahoney
2011-10-10 16:35   ` David Sterba
2011-10-10 16:42   ` David Sterba
2011-10-10 16:54     ` Jeff Mahoney
2011-10-04  3:22 ` [patch 02/65] btrfs: Catch locking failures in {set,clear}_extent_bit Jeff Mahoney
2011-10-04  3:22 ` [patch 03/65] btrfs: Panic on bad rbtree operations Jeff Mahoney
2011-10-04  3:22 ` [patch 04/65] btrfs: Simplify btrfs_insert_root Jeff Mahoney
2011-10-04  3:22 ` [patch 05/65] btrfs: set_extent_bit error push-up Jeff Mahoney
2011-10-04  3:22 ` [patch 06/65] btrfs: lock_extent " Jeff Mahoney
2011-10-04  3:22 ` [patch 07/65] btrfs: clear_extent_bit " Jeff Mahoney
2011-10-04  3:22 ` [patch 08/65] btrfs: unlock_extent " Jeff Mahoney
2011-10-04  3:22 ` [patch 09/65] btrfs: pin_down_extent should return void Jeff Mahoney
2011-10-04  3:22 ` [patch 10/65] btrfs: btrfs_pin_extent error push-up Jeff Mahoney
2011-10-04  3:22 ` [patch 11/65] btrfs: btrfs_drop_snapshot should return int Jeff Mahoney
2011-10-04  3:22 ` [patch 12/65] btrfs: btrfs_start_transaction non-looped error push-up Jeff Mahoney
2011-10-04  3:22 ` [patch 13/65] btrfs: find_and_setup_root " Jeff Mahoney
2011-10-04  3:22 ` [patch 14/65] btrfs: btrfs_update_root " Jeff Mahoney
2011-10-04  3:22 ` [patch 15/65] btrfs: set_range_writeback should return void Jeff Mahoney
2011-10-04  3:22 ` [patch 16/65] btrfs: wait_on_state " Jeff Mahoney
2011-10-04  3:22 ` [patch 17/65] btrfs: wait_extent_bit " Jeff Mahoney
2011-10-04  3:22 ` [patch 18/65] btrfs: __unlock_for_delalloc " Jeff Mahoney
2011-10-04  3:22 ` [patch 19/65] btrfs: check_page_uptodate " Jeff Mahoney
2011-10-04  3:22 ` [patch 20/65] btrfs: check_page_locked " Jeff Mahoney
2011-10-04  3:22 ` [patch 21/65] btrfs: check_page_writeback " Jeff Mahoney
2011-10-04  3:22 ` [patch 22/65] btrfs: clear_extent_buffer_dirty " Jeff Mahoney
2011-10-04  3:22 ` [patch 23/65] btrfs: btrfs_cleanup_fs_uuids " Jeff Mahoney
2011-10-04  3:22 ` [patch 24/65] btrfs: run_scheduled_bios " Jeff Mahoney
2011-10-04  3:22 ` [patch 25/65] btrfs: btrfs_close_extra_devices " Jeff Mahoney
2011-10-04  3:22 ` [patch 26/65] btrfs: schedule_bio " Jeff Mahoney
2011-10-04  3:22 ` [patch 27/65] btrfs: fill_device_from_item " Jeff Mahoney
2011-10-04  3:22 ` [patch 28/65] btrfs: btrfs_queue_worker " Jeff Mahoney
2011-10-04  3:22 ` [patch 29/65] btrfs: run_ordered_completions " Jeff Mahoney
2011-10-04  3:23 ` [patch 30/65] btrfs: btrfs_stop_workers " Jeff Mahoney
2011-10-04  3:23 ` [patch 31/65] btrfs: btrfs_requeue_work " Jeff Mahoney
2011-10-04  3:23 ` [patch 32/65] btrfs: tree-log: btrfs_end_log_trans " Jeff Mahoney
2011-10-04  3:23 ` [patch 33/65] btrfs: tree-log: wait_for_writer " Jeff Mahoney
2011-10-04  3:23 ` [patch 34/65] btrfs: btrfs_init_compress " Jeff Mahoney
2011-10-04  3:23 ` [patch 35/65] btrfs: btrfs_invalidate_inodes " Jeff Mahoney
2011-10-04  3:23 ` [patch 36/65] btrfs: __setup_root " Jeff Mahoney
2011-10-04  3:23 ` [patch 37/65] btrfs: btrfs_destroy_delalloc_inodes " Jeff Mahoney
2011-10-04  3:23 ` [patch 38/65] btrfs: btrfs_prepare_extent_commit " Jeff Mahoney
2011-10-04  3:23 ` [patch 39/65] btrfs: btrfs_set_block_group_rw " Jeff Mahoney
2011-10-04  3:23 ` [patch 40/65] btrfs: setup_inline_extent_backref " Jeff Mahoney
2011-10-04  3:23 ` [patch 41/65] btrfs: btrfs_run_defrag_inodes " Jeff Mahoney
2011-10-04  3:23 ` [patch 42/65] btrfs: Simplify btrfs_submit_bio_hook Jeff Mahoney
2011-10-04  3:23 ` [patch 43/65] btrfs: Factor out tree->ops->merge_bio_hook call Jeff Mahoney
2011-10-04  3:23 ` [patch 44/65] btrfs: ->submit_bio_hook error push-up Jeff Mahoney
2011-10-04  3:23 ` [patch 45/65] btrfs: __add_reloc_root " Jeff Mahoney
2011-10-04  3:23 ` [patch 46/65] btrfs: fixup_low_keys should return void Jeff Mahoney
2011-10-04  3:23 ` [patch 47/65] btrfs: setup_items_for_insert " Jeff Mahoney
2011-10-04  3:23 ` [patch 48/65] btrfs: del_ptr " Jeff Mahoney
2011-10-04  3:23 ` [patch 49/65] btrfs: insert_ptr " Jeff Mahoney
2011-10-04  3:23 ` [patch 50/65] btrfs: add_delayed_ref_head " Jeff Mahoney
2011-10-04  3:23 ` [patch 51/65] btrfs: add_delayed_tree_ref " Jeff Mahoney
2011-10-04  3:23 ` [patch 52/65] btrfs: add_delayed_data_ref " Jeff Mahoney
2011-10-04  3:23 ` [patch 53/65] btrfs: Fix kfree of member instead of structure Jeff Mahoney
2011-10-04  3:23 ` [patch 54/65] btrfs: Use mempools for delayed refs Jeff Mahoney
2011-10-04  3:23 ` [patch 55/65] btrfs: Delayed ref mempool functions should return void Jeff Mahoney
2011-10-04  3:23 ` [patch 56/65] btrfs: btrfs_inc_extent_ref void return prep Jeff Mahoney
2011-10-04  3:23 ` Jeff Mahoney [this message]
2011-10-04  3:23 ` [patch 58/65] btrfs: __btrfs_mod_refs process_func should return void Jeff Mahoney
2011-10-04  3:23 ` [patch 59/65] btrfs: __btrfs_mod_ref " Jeff Mahoney
2011-10-04  3:23 ` [patch 60/65] btrfs: clean_tree_block " Jeff Mahoney
2011-10-04  3:23 ` [patch 61/65] btrfs: btrfs_truncate_item " Jeff Mahoney
2011-10-04  3:23 ` [patch 62/65] btrfs: btrfs_extend_item " Jeff Mahoney
2011-10-04  3:23 ` [patch 63/65] btrfs: end_compressed_writeback " Jeff Mahoney
2011-10-04  3:23 ` [patch 64/65] btrfs: copy_for_split " Jeff Mahoney
2011-10-04  3:23 ` [patch 65/65] btrfs: update_inline_extent_backref " Jeff Mahoney

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=20111004032306.448444830@suse.com \
    --to=jeffm@suse.com \
    --cc=chris.mason@oracle.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).