* [PATCH] btrfs: Open code insert_extent_backref
@ 2020-03-04 9:33 Nikolay Borisov
2020-03-04 18:49 ` Josef Bacik
2020-03-04 19:27 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Nikolay Borisov @ 2020-03-04 9:33 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
No need to add a level of indirection for hiding a simple 'if'. Open
code insert_extent_backref in its sole caller. No functional changes.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/extent-tree.c | 29 +++++++++--------------------
1 file changed, 9 insertions(+), 20 deletions(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 36374b86529c..a3778937d705 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1189,24 +1189,6 @@ int insert_inline_extent_backref(struct btrfs_trans_handle *trans,
return ret;
}
-static int insert_extent_backref(struct btrfs_trans_handle *trans,
- struct btrfs_path *path,
- u64 bytenr, u64 parent, u64 root_objectid,
- u64 owner, u64 offset, int refs_to_add)
-{
- int ret;
- if (owner < BTRFS_FIRST_FREE_OBJECTID) {
- BUG_ON(refs_to_add != 1);
- ret = insert_tree_block_ref(trans, path, bytenr, parent,
- root_objectid);
- } else {
- ret = insert_extent_data_ref(trans, path, bytenr, parent,
- root_objectid, owner, offset,
- refs_to_add);
- }
- return ret;
-}
-
static int remove_extent_backref(struct btrfs_trans_handle *trans,
struct btrfs_path *path,
struct btrfs_extent_inline_ref *iref,
@@ -1493,8 +1475,15 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
path->reada = READA_FORWARD;
path->leave_spinning = 1;
/* now insert the actual backref */
- ret = insert_extent_backref(trans, path, bytenr, parent, root_objectid,
- owner, offset, refs_to_add);
+ if (owner < BTRFS_FIRST_FREE_OBJECTID) {
+ BUG_ON(refs_to_add != 1);
+ ret = insert_tree_block_ref(trans, path, bytenr, parent,
+ root_objectid);
+ } else {
+ ret = insert_extent_data_ref(trans, path, bytenr, parent,
+ root_objectid, owner, offset,
+ refs_to_add);
+ }
if (ret)
btrfs_abort_transaction(trans, ret);
out:
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: Open code insert_extent_backref
2020-03-04 9:33 [PATCH] btrfs: Open code insert_extent_backref Nikolay Borisov
@ 2020-03-04 18:49 ` Josef Bacik
2020-03-04 19:27 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2020-03-04 18:49 UTC (permalink / raw)
To: Nikolay Borisov, linux-btrfs
On 3/4/20 4:33 AM, Nikolay Borisov wrote:
> No need to add a level of indirection for hiding a simple 'if'. Open
> code insert_extent_backref in its sole caller. No functional changes.
>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Thanks,
Josef
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: Open code insert_extent_backref
2020-03-04 9:33 [PATCH] btrfs: Open code insert_extent_backref Nikolay Borisov
2020-03-04 18:49 ` Josef Bacik
@ 2020-03-04 19:27 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2020-03-04 19:27 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: linux-btrfs
On Wed, Mar 04, 2020 at 11:33:53AM +0200, Nikolay Borisov wrote:
> No need to add a level of indirection for hiding a simple 'if'. Open
> code insert_extent_backref in its sole caller. No functional changes.
>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Added to misc-next, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-04 19:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-04 9:33 [PATCH] btrfs: Open code insert_extent_backref Nikolay Borisov
2020-03-04 18:49 ` Josef Bacik
2020-03-04 19:27 ` David Sterba
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.