From: Jeff Mahoney <jeffm@suse.com>
To: Chris Mason <chris.mason@oracle.com>, David Sterba <dsterba@suse.com>
Cc: Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: [patch 56/66] btrfs: Delayed ref mempool functions should return void
Date: Mon, 24 Oct 2011 21:03:32 -0400 [thread overview]
Message-ID: <20111025010856.990696748@suse.com> (raw)
In-Reply-To: 20111025010236.322699279@suse.com
Now that the delayed ref code uses mempools, allocations can't fail,
and there are no more error conditions to report.
This patch makes the following functions return void:
- btrfs_alloc_reserved_file_extent
- btrfs_add_delayed_tree_ref
- btrfs_add_delayed_data_ref
- btrfs_add_delayed_extent_op
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/btrfs/ctree.h | 8 ++--
fs/btrfs/delayed-ref.c | 27 +++++++---------
fs/btrfs/delayed-ref.h | 24 +++++++-------
fs/btrfs/extent-tree.c | 78 ++++++++++++++++++++---------------------------
fs/btrfs/inode.c | 6 +--
5 files changed, 63 insertions(+), 80 deletions(-)
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index ea47c73..f704253 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2179,10 +2179,10 @@ struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
u64 bytenr, u32 blocksize,
int level);
-int btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
- u64 root_objectid, u64 owner,
- u64 offset, struct btrfs_key *ins);
+void btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
+ u64 root_objectid, u64 owner,
+ u64 offset, struct btrfs_key *ins);
int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
u64 root_objectid, u64 owner, u64 offset,
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index a70c40d..16aea4e 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -586,10 +586,10 @@ static noinline void add_delayed_data_ref(struct btrfs_trans_handle *trans,
* to make sure the delayed ref is eventually processed before this
* transaction commits.
*/
-int btrfs_add_delayed_tree_ref(struct btrfs_trans_handle *trans,
- u64 bytenr, u64 num_bytes, u64 parent,
- u64 ref_root, int level, int action,
- struct btrfs_delayed_extent_op *extent_op)
+void btrfs_add_delayed_tree_ref(struct btrfs_trans_handle *trans,
+ u64 bytenr, u64 num_bytes, u64 parent,
+ u64 ref_root, int level, int action,
+ struct btrfs_delayed_extent_op *extent_op)
{
struct btrfs_delayed_tree_ref *ref;
struct btrfs_delayed_ref_head *head_ref;
@@ -613,17 +613,16 @@ int btrfs_add_delayed_tree_ref(struct btrfs_trans_handle *trans,
add_delayed_tree_ref(trans, &ref->node, bytenr, num_bytes, parent,
ref_root, level, action);
spin_unlock(&delayed_refs->lock);
- return 0;
}
/*
* add a delayed data ref. it's similar to btrfs_add_delayed_tree_ref.
*/
-int btrfs_add_delayed_data_ref(struct btrfs_trans_handle *trans,
- u64 bytenr, u64 num_bytes,
- u64 parent, u64 ref_root,
- u64 owner, u64 offset, int action,
- struct btrfs_delayed_extent_op *extent_op)
+void btrfs_add_delayed_data_ref(struct btrfs_trans_handle *trans,
+ u64 bytenr, u64 num_bytes,
+ u64 parent, u64 ref_root,
+ u64 owner, u64 offset, int action,
+ struct btrfs_delayed_extent_op *extent_op)
{
struct btrfs_delayed_data_ref *ref;
struct btrfs_delayed_ref_head *head_ref;
@@ -647,12 +646,11 @@ int btrfs_add_delayed_data_ref(struct btrfs_trans_handle *trans,
add_delayed_data_ref(trans, &ref->node, bytenr, num_bytes, parent,
ref_root, owner, offset, action);
spin_unlock(&delayed_refs->lock);
- return 0;
}
-int btrfs_add_delayed_extent_op(struct btrfs_trans_handle *trans,
- u64 bytenr, u64 num_bytes,
- struct btrfs_delayed_extent_op *extent_op)
+void btrfs_add_delayed_extent_op(struct btrfs_trans_handle *trans,
+ u64 bytenr, u64 num_bytes,
+ struct btrfs_delayed_extent_op *extent_op)
{
struct btrfs_delayed_ref_head *head_ref;
struct btrfs_delayed_ref_root *delayed_refs;
@@ -666,7 +664,6 @@ int btrfs_add_delayed_extent_op(struct btrfs_trans_handle *trans,
add_delayed_ref_head(trans, &head_ref->node, bytenr, num_bytes,
BTRFS_UPDATE_DELAYED_HEAD, extent_op->is_data);
spin_unlock(&delayed_refs->lock);
- return 0;
}
/*
diff --git a/fs/btrfs/delayed-ref.h b/fs/btrfs/delayed-ref.h
index 6c41d8d..8b2cec2 100644
--- a/fs/btrfs/delayed-ref.h
+++ b/fs/btrfs/delayed-ref.h
@@ -152,18 +152,18 @@ static inline void btrfs_put_delayed_ref(struct btrfs_delayed_ref_node *ref)
}
}
-int btrfs_add_delayed_tree_ref(struct btrfs_trans_handle *trans,
- u64 bytenr, u64 num_bytes, u64 parent,
- u64 ref_root, int level, int action,
- struct btrfs_delayed_extent_op *extent_op);
-int btrfs_add_delayed_data_ref(struct btrfs_trans_handle *trans,
- u64 bytenr, u64 num_bytes,
- u64 parent, u64 ref_root,
- u64 owner, u64 offset, int action,
- struct btrfs_delayed_extent_op *extent_op);
-int btrfs_add_delayed_extent_op(struct btrfs_trans_handle *trans,
- u64 bytenr, u64 num_bytes,
- struct btrfs_delayed_extent_op *extent_op);
+void btrfs_add_delayed_tree_ref(struct btrfs_trans_handle *trans,
+ u64 bytenr, u64 num_bytes, u64 parent,
+ u64 ref_root, int level, int action,
+ struct btrfs_delayed_extent_op *extent_op);
+void btrfs_add_delayed_data_ref(struct btrfs_trans_handle *trans,
+ u64 bytenr, u64 num_bytes,
+ u64 parent, u64 ref_root,
+ u64 owner, u64 offset, int action,
+ struct btrfs_delayed_extent_op *extent_op);
+void btrfs_add_delayed_extent_op(struct btrfs_trans_handle *trans,
+ u64 bytenr, u64 num_bytes,
+ struct btrfs_delayed_extent_op *extent_op);
struct btrfs_delayed_ref_head *
btrfs_find_delayed_ref_head(struct btrfs_trans_handle *trans, u64 bytenr);
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index a706480..fe95f37 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1837,20 +1837,19 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
u64 bytenr, u64 num_bytes, u64 parent,
u64 root_objectid, u64 owner, u64 offset)
{
- int ret;
BUG_ON(owner < BTRFS_FIRST_FREE_OBJECTID &&
root_objectid == BTRFS_TREE_LOG_OBJECTID);
if (owner < BTRFS_FIRST_FREE_OBJECTID) {
- ret = btrfs_add_delayed_tree_ref(trans, bytenr, num_bytes,
- parent, root_objectid, (int)owner,
- BTRFS_ADD_DELAYED_REF, NULL);
+ btrfs_add_delayed_tree_ref(trans, bytenr, num_bytes, parent,
+ root_objectid, (int)owner,
+ BTRFS_ADD_DELAYED_REF, NULL);
} else {
- ret = btrfs_add_delayed_data_ref(trans, bytenr, num_bytes,
- parent, root_objectid, owner, offset,
- BTRFS_ADD_DELAYED_REF, NULL);
+ btrfs_add_delayed_data_ref(trans, bytenr, num_bytes, parent,
+ root_objectid, owner, offset,
+ BTRFS_ADD_DELAYED_REF, NULL);
}
- return ret;
+ return 0;
}
static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
@@ -2363,7 +2362,6 @@ int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
int is_data)
{
struct btrfs_delayed_extent_op *extent_op;
- int ret;
extent_op = kmalloc(sizeof(*extent_op), GFP_NOFS);
if (!extent_op)
@@ -2374,10 +2372,8 @@ int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
extent_op->update_key = 0;
extent_op->is_data = is_data ? 1 : 0;
- ret = btrfs_add_delayed_extent_op(trans, bytenr, num_bytes, extent_op);
- if (ret)
- kfree(extent_op);
- return ret;
+ btrfs_add_delayed_extent_op(trans, bytenr, num_bytes, extent_op);
+ return 0;
}
static noinline int check_delayed_ref(struct btrfs_trans_handle *trans,
@@ -4767,11 +4763,10 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
int ret;
if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) {
- ret = btrfs_add_delayed_tree_ref(trans, buf->start, buf->len,
- parent, root->root_key.objectid,
- btrfs_header_level(buf),
- BTRFS_DROP_DELAYED_REF, NULL);
- BUG_ON(ret);
+ btrfs_add_delayed_tree_ref(trans, buf->start, buf->len,
+ parent, root->root_key.objectid,
+ btrfs_header_level(buf),
+ BTRFS_DROP_DELAYED_REF, NULL);
}
if (!last_ref)
@@ -4824,18 +4819,15 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans,
btrfs_panic(root->fs_info, ret, "Cannot pin "
"extent in range %llu(%llu)\n",
bytenr, num_bytes);
- } else if (owner < BTRFS_FIRST_FREE_OBJECTID) {
- ret = btrfs_add_delayed_tree_ref(trans, bytenr, num_bytes,
- parent, root_objectid, (int)owner,
- BTRFS_DROP_DELAYED_REF, NULL);
- BUG_ON(ret);
- } else {
- ret = btrfs_add_delayed_data_ref(trans, bytenr, num_bytes,
- parent, root_objectid, owner,
- offset, BTRFS_DROP_DELAYED_REF, NULL);
- BUG_ON(ret);
- }
- return ret;
+ } else if (owner < BTRFS_FIRST_FREE_OBJECTID)
+ btrfs_add_delayed_tree_ref(trans, bytenr, num_bytes, parent,
+ root_objectid, (int)owner,
+ BTRFS_DROP_DELAYED_REF, NULL);
+ else
+ btrfs_add_delayed_data_ref(trans, bytenr, num_bytes, parent,
+ root_objectid, owner, offset,
+ BTRFS_DROP_DELAYED_REF, NULL);
+ return 0;
}
static u64 stripe_align(struct btrfs_root *root, u64 val)
@@ -5624,19 +5616,16 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
return ret;
}
-int btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
- u64 root_objectid, u64 owner,
- u64 offset, struct btrfs_key *ins)
+void btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
+ u64 root_objectid, u64 owner,
+ u64 offset, struct btrfs_key *ins)
{
- int ret;
-
BUG_ON(root_objectid == BTRFS_TREE_LOG_OBJECTID);
- ret = btrfs_add_delayed_data_ref(trans, ins->objectid, ins->offset,
- 0, root_objectid, owner, offset,
- BTRFS_ADD_DELAYED_EXTENT, NULL);
- return ret;
+ btrfs_add_delayed_data_ref(trans, ins->objectid, ins->offset,
+ 0, root_objectid, owner, offset,
+ BTRFS_ADD_DELAYED_EXTENT, NULL);
}
/*
@@ -5851,11 +5840,10 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
extent_op->update_flags = 1;
extent_op->is_data = 0;
- ret = btrfs_add_delayed_tree_ref(trans, ins.objectid,
- ins.offset, parent, root_objectid,
- level, BTRFS_ADD_DELAYED_EXTENT,
- extent_op);
- BUG_ON(ret);
+ btrfs_add_delayed_tree_ref(trans, ins.objectid,
+ ins.offset, parent, root_objectid,
+ level, BTRFS_ADD_DELAYED_EXTENT,
+ extent_op);
}
return buf;
}
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1a9574f..46f3d4a 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1706,10 +1706,8 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
ins.objectid = disk_bytenr;
ins.offset = disk_num_bytes;
ins.type = BTRFS_EXTENT_ITEM_KEY;
- ret = btrfs_alloc_reserved_file_extent(trans, root,
- root->root_key.objectid,
- btrfs_ino(inode), file_pos, &ins);
- BUG_ON(ret);
+ btrfs_alloc_reserved_file_extent(trans, root, root->root_key.objectid,
+ btrfs_ino(inode), file_pos, &ins);
btrfs_free_path(path);
return 0;
next prev parent reply other threads:[~2011-10-25 1:03 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-25 1:02 [patch 00/66] [pull] Error handling patchset v5 Jeff Mahoney
2011-10-25 1:02 ` [patch 01/66] btrfs: Add btrfs_panic() Jeff Mahoney
2011-10-25 1:02 ` [patch 02/66] btrfs: Catch locking failures in {set,clear,convert}_extent_bit Jeff Mahoney
2011-10-25 1:02 ` [patch 03/66] btrfs: Panic on bad rbtree operations Jeff Mahoney
2011-10-25 1:02 ` [patch 04/66] btrfs: Simplify btrfs_insert_root Jeff Mahoney
2011-10-25 1:02 ` [patch 05/66] btrfs: set_extent_bit error push-up Jeff Mahoney
2011-10-25 1:02 ` [patch 06/66] btrfs: lock_extent " Jeff Mahoney
2011-10-25 1:02 ` [patch 07/66] btrfs: clear_extent_bit " Jeff Mahoney
2011-10-26 15:10 ` David Sterba
2011-10-26 15:18 ` Jeff Mahoney
2011-10-26 16:09 ` David Sterba
2011-10-26 16:13 ` Jeff Mahoney
2011-10-31 12:30 ` Ilya Dryomov
2011-10-31 13:00 ` Chris Mason
2011-10-31 13:34 ` Jeff Mahoney
2011-10-27 12:00 ` David Sterba
2011-10-31 15:07 ` David Sterba
2011-10-31 15:41 ` [patch 07/66] btrfs: clear_extent_bit error push-up [other BUG hit] David Sterba
2011-10-25 1:02 ` [patch 08/66] btrfs: convert_extent_bit error push-up Jeff Mahoney
2011-10-25 1:02 ` [patch 09/66] btrfs: unlock_extent " Jeff Mahoney
2011-10-25 1:02 ` [patch 10/66] btrfs: pin_down_extent should return void Jeff Mahoney
2011-10-25 1:02 ` [patch 11/66] btrfs: btrfs_pin_extent error push-up Jeff Mahoney
2011-10-25 1:02 ` [patch 12/66] btrfs: btrfs_drop_snapshot should return int Jeff Mahoney
2011-10-25 1:02 ` [patch 13/66] btrfs: btrfs_start_transaction non-looped error push-up Jeff Mahoney
2011-10-25 1:02 ` [patch 14/66] btrfs: find_and_setup_root " Jeff Mahoney
2011-10-25 1:02 ` [patch 15/66] btrfs: btrfs_update_root " Jeff Mahoney
2011-10-25 1:02 ` [patch 16/66] btrfs: set_range_writeback should return void Jeff Mahoney
2011-10-25 1:02 ` [patch 17/66] btrfs: wait_on_state " Jeff Mahoney
2011-10-25 1:02 ` [patch 18/66] btrfs: wait_extent_bit " Jeff Mahoney
2011-10-25 1:02 ` [patch 19/66] btrfs: __unlock_for_delalloc " Jeff Mahoney
2011-10-25 1:02 ` [patch 20/66] btrfs: check_page_uptodate " Jeff Mahoney
2011-10-25 1:02 ` [patch 21/66] btrfs: check_page_locked " Jeff Mahoney
2011-10-25 1:02 ` [patch 22/66] btrfs: check_page_writeback " Jeff Mahoney
2011-10-25 1:02 ` [patch 23/66] btrfs: clear_extent_buffer_dirty " Jeff Mahoney
2011-10-25 1:03 ` [patch 24/66] btrfs: btrfs_cleanup_fs_uuids " Jeff Mahoney
2011-10-25 1:03 ` [patch 25/66] btrfs: run_scheduled_bios " Jeff Mahoney
2011-10-25 1:03 ` [patch 26/66] btrfs: btrfs_close_extra_devices " Jeff Mahoney
2011-10-25 1:03 ` [patch 27/66] btrfs: schedule_bio " Jeff Mahoney
2011-10-25 1:03 ` [patch 28/66] btrfs: fill_device_from_item " Jeff Mahoney
2011-10-25 1:03 ` [patch 29/66] btrfs: btrfs_queue_worker " Jeff Mahoney
2011-10-25 1:03 ` [patch 30/66] btrfs: run_ordered_completions " Jeff Mahoney
2011-10-25 1:03 ` [patch 31/66] btrfs: btrfs_stop_workers " Jeff Mahoney
2011-10-25 1:03 ` [patch 32/66] btrfs: btrfs_requeue_work " Jeff Mahoney
2011-10-25 1:03 ` [patch 33/66] btrfs: tree-log: btrfs_end_log_trans " Jeff Mahoney
2011-10-25 1:03 ` [patch 34/66] btrfs: tree-log: wait_for_writer " Jeff Mahoney
2011-10-25 1:03 ` [patch 35/66] btrfs: btrfs_init_compress " Jeff Mahoney
2011-10-25 1:03 ` [patch 36/66] btrfs: btrfs_invalidate_inodes " Jeff Mahoney
2011-10-25 1:03 ` [patch 37/66] btrfs: __setup_root " Jeff Mahoney
2011-10-25 1:03 ` [patch 38/66] btrfs: btrfs_destroy_delalloc_inodes " Jeff Mahoney
2011-10-25 1:03 ` [patch 39/66] btrfs: btrfs_prepare_extent_commit " Jeff Mahoney
2011-10-25 1:03 ` [patch 40/66] btrfs: btrfs_set_block_group_rw " Jeff Mahoney
2011-10-25 1:03 ` [patch 41/66] btrfs: setup_inline_extent_backref " Jeff Mahoney
2011-10-25 1:03 ` [patch 42/66] btrfs: btrfs_run_defrag_inodes " Jeff Mahoney
2011-10-25 1:03 ` [patch 43/66] btrfs: Simplify btrfs_submit_bio_hook Jeff Mahoney
2011-10-25 1:03 ` [patch 44/66] btrfs: Factor out tree->ops->merge_bio_hook call Jeff Mahoney
2011-10-25 1:03 ` [patch 45/66] btrfs: ->submit_bio_hook error push-up Jeff Mahoney
2011-10-25 1:03 ` [patch 46/66] btrfs: __add_reloc_root " Jeff Mahoney
2011-10-25 1:03 ` [patch 47/66] btrfs: fixup_low_keys should return void Jeff Mahoney
2011-10-25 1:03 ` [patch 48/66] btrfs: setup_items_for_insert " Jeff Mahoney
2011-10-25 1:03 ` [patch 49/66] btrfs: del_ptr " Jeff Mahoney
2011-10-25 1:03 ` [patch 50/66] btrfs: insert_ptr " Jeff Mahoney
2011-10-25 1:03 ` [patch 51/66] btrfs: add_delayed_ref_head " Jeff Mahoney
2011-10-25 1:03 ` [patch 52/66] btrfs: add_delayed_tree_ref " Jeff Mahoney
2011-10-25 1:03 ` [patch 53/66] btrfs: add_delayed_data_ref " Jeff Mahoney
2011-10-25 1:03 ` [patch 54/66] btrfs: Fix kfree of member instead of structure Jeff Mahoney
2011-10-25 1:03 ` [patch 55/66] btrfs: Use mempools for delayed refs Jeff Mahoney
2011-10-25 1:03 ` Jeff Mahoney [this message]
2011-10-25 1:03 ` [patch 57/66] btrfs: btrfs_inc_extent_ref void return prep Jeff Mahoney
2011-10-25 1:03 ` [patch 58/66] btrfs: btrfs_free_extent " Jeff Mahoney
2011-10-25 1:03 ` [patch 59/66] btrfs: __btrfs_mod_refs process_func should return void Jeff Mahoney
2011-10-25 1:03 ` [patch 60/66] btrfs: __btrfs_mod_ref " Jeff Mahoney
2011-10-25 1:03 ` [patch 61/66] btrfs: clean_tree_block " Jeff Mahoney
2011-10-25 1:03 ` [patch 62/66] btrfs: btrfs_truncate_item " Jeff Mahoney
2011-10-25 1:03 ` [patch 63/66] btrfs: btrfs_extend_item " Jeff Mahoney
2011-10-25 1:03 ` [patch 64/66] btrfs: end_compressed_writeback " Jeff Mahoney
2011-10-25 1:03 ` [patch 65/66] btrfs: copy_for_split " Jeff Mahoney
2011-10-25 1:03 ` [patch 66/66] 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=20111025010856.990696748@suse.com \
--to=jeffm@suse.com \
--cc=chris.mason@oracle.com \
--cc=dsterba@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.