From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 01/11] btrfs-progs: check: Remove root argument from delete_extent_records
Date: Mon, 28 May 2018 09:36:40 +0300 [thread overview]
Message-ID: <1527489410-3564-2-git-send-email-nborisov@suse.com> (raw)
In-Reply-To: <1527489410-3564-1-git-send-email-nborisov@suse.com>
This function is always passed the extent_root as "root" parameter. In
turn it uses the root parameter to mostly access fs_info and performs
only a single call to btrfs_update_block_group where it passses the
passed root. This is all redundant since fs_info can be referenced
from the transaction handle and in turn extent_root can be referenced
from the fs_info. So do that to simplify the function's signature.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
check/main.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/check/main.c b/check/main.c
index 68da994f7ae0..4cf243d9b379 100644
--- a/check/main.c
+++ b/check/main.c
@@ -6295,10 +6295,10 @@ static int free_extent_hook(struct btrfs_trans_handle *trans,
}
static int delete_extent_records(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
struct btrfs_path *path,
u64 bytenr)
{
+ struct btrfs_fs_info *fs_info = trans->fs_info;
struct btrfs_key key;
struct btrfs_key found_key;
struct extent_buffer *leaf;
@@ -6311,8 +6311,8 @@ static int delete_extent_records(struct btrfs_trans_handle *trans,
key.offset = (u64)-1;
while (1) {
- ret = btrfs_search_slot(trans, root->fs_info->extent_root,
- &key, path, 0, 1);
+ ret = btrfs_search_slot(trans, fs_info->extent_root, &key,
+ path, 0, 1);
if (ret < 0)
break;
@@ -6354,7 +6354,7 @@ static int delete_extent_records(struct btrfs_trans_handle *trans,
"repair deleting extent record: key [%llu,%u,%llu]\n",
found_key.objectid, found_key.type, found_key.offset);
- ret = btrfs_del_item(trans, root->fs_info->extent_root, path);
+ ret = btrfs_del_item(trans, fs_info->extent_root, path);
if (ret)
break;
btrfs_release_path(path);
@@ -6362,10 +6362,10 @@ static int delete_extent_records(struct btrfs_trans_handle *trans,
if (found_key.type == BTRFS_EXTENT_ITEM_KEY ||
found_key.type == BTRFS_METADATA_ITEM_KEY) {
u64 bytes = (found_key.type == BTRFS_EXTENT_ITEM_KEY) ?
- found_key.offset : root->fs_info->nodesize;
+ found_key.offset : fs_info->nodesize;
- ret = btrfs_update_block_group(root, bytenr,
- bytes, 0, 0);
+ ret = btrfs_update_block_group(fs_info->extent_root,
+ bytenr, bytes, 0, 0);
if (ret)
break;
}
@@ -7293,8 +7293,7 @@ static int fixup_extent_refs(struct btrfs_fs_info *info,
}
/* step two, delete all the existing records */
- ret = delete_extent_records(trans, info->extent_root, &path,
- rec->start);
+ ret = delete_extent_records(trans, &path, rec->start);
if (ret < 0)
goto out;
--
2.7.4
next prev parent reply other threads:[~2018-05-28 16:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-28 6:36 [PATCH 00/11] Summer argument cleanup Nikolay Borisov
2018-05-28 6:36 ` Nikolay Borisov [this message]
2018-05-28 6:36 ` [PATCH 02/11] btrfs-progs: check: Remove root parameter from btrfs_fix_block_accounting Nikolay Borisov
2018-05-28 6:36 ` [PATCH 03/11] btrfs-progs: check: Remove root parameter from del_pending_extents Nikolay Borisov
2018-05-28 6:36 ` [PATCH 04/11] btrfs-progs: check: Remove root argument from finish_current_insert Nikolay Borisov
2018-05-28 6:36 ` [PATCH 05/11] btrfs-progs: check: Make update_pinned_extents take btrfs_fs_info Nikolay Borisov
2018-05-28 6:36 ` [PATCH 06/11] btrfs-progs: Remove unused argument from clean_tree_block Nikolay Borisov
2018-05-28 6:36 ` [PATCH 07/11] btrfs-progs: check: Remove unused root argument from btrfs_extent_post_op Nikolay Borisov
2018-05-28 6:36 ` [PATCH 08/11] btrfs-progs: Change btrfs_root to btrfs_fs_info argument in btrfs_lookup_extent_info Nikolay Borisov
2018-05-28 6:36 ` [PATCH 09/11] btrfs-progs: Remove root argument from btrfs_set_block_flags Nikolay Borisov
2018-05-28 6:36 ` [PATCH 10/11] btrfs-progs: Remove root argument from write_one_cache_group Nikolay Borisov
2018-05-28 6:36 ` [PATCH 11/11] btrfs-progs: Remove fs_info argument from write_ctree_super Nikolay Borisov
2018-05-29 1:06 ` [PATCH 00/11] Summer argument cleanup Lu Fengqi
2018-05-31 11:34 ` David Sterba
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=1527489410-3564-2-git-send-email-nborisov@suse.com \
--to=nborisov@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 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).