From: Nikolay Borisov <nborisov@suse.com>
To: dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org, Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 05/10] btrfs: Remove unused arguments from btrfs_changed_cb_t
Date: Mon, 21 Aug 2017 12:43:45 +0300 [thread overview]
Message-ID: <1503308630-6652-6-git-send-email-nborisov@suse.com> (raw)
In-Reply-To: <1503308630-6652-1-git-send-email-nborisov@suse.com>
btrfs_changed_cb_t represents the signature of the callback being passed to
btrfs_compare_trees. Currently there is only one such callback, namely
changed_cb in send.c. This function doesn't really uses the first 2 parameters,
i.e. the roots. Since there are not other functions implementing the
btrfs_changed_cb_t let's remove the unused parameters from the prototype and
implementation
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/ctree.c | 15 +++++----------
fs/btrfs/ctree.h | 4 +---
fs/btrfs/send.c | 8 +++-----
3 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 6d49db7d86be..19b9c5131745 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -5496,8 +5496,7 @@ int btrfs_compare_trees(struct btrfs_root *left_root,
goto out;
} else if (left_end_reached) {
if (right_level == 0) {
- ret = changed_cb(left_root, right_root,
- left_path, right_path,
+ ret = changed_cb(left_path, right_path,
&right_key,
BTRFS_COMPARE_TREE_DELETED,
ctx);
@@ -5508,8 +5507,7 @@ int btrfs_compare_trees(struct btrfs_root *left_root,
continue;
} else if (right_end_reached) {
if (left_level == 0) {
- ret = changed_cb(left_root, right_root,
- left_path, right_path,
+ ret = changed_cb(left_path, right_path,
&left_key,
BTRFS_COMPARE_TREE_NEW,
ctx);
@@ -5523,8 +5521,7 @@ int btrfs_compare_trees(struct btrfs_root *left_root,
if (left_level == 0 && right_level == 0) {
cmp = btrfs_comp_cpu_keys(&left_key, &right_key);
if (cmp < 0) {
- ret = changed_cb(left_root, right_root,
- left_path, right_path,
+ ret = changed_cb(left_path, right_path,
&left_key,
BTRFS_COMPARE_TREE_NEW,
ctx);
@@ -5532,8 +5529,7 @@ int btrfs_compare_trees(struct btrfs_root *left_root,
goto out;
advance_left = ADVANCE;
} else if (cmp > 0) {
- ret = changed_cb(left_root, right_root,
- left_path, right_path,
+ ret = changed_cb(left_path, right_path,
&right_key,
BTRFS_COMPARE_TREE_DELETED,
ctx);
@@ -5550,8 +5546,7 @@ int btrfs_compare_trees(struct btrfs_root *left_root,
result = BTRFS_COMPARE_TREE_CHANGED;
else
result = BTRFS_COMPARE_TREE_SAME;
- ret = changed_cb(left_root, right_root,
- left_path, right_path,
+ ret = changed_cb(left_path, right_path,
&left_key, result, ctx);
if (ret < 0)
goto out;
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index ca087ad5ac48..260d8464fac4 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2811,9 +2811,7 @@ enum btrfs_compare_tree_result {
BTRFS_COMPARE_TREE_CHANGED,
BTRFS_COMPARE_TREE_SAME,
};
-typedef int (*btrfs_changed_cb_t)(struct btrfs_root *left_root,
- struct btrfs_root *right_root,
- struct btrfs_path *left_path,
+typedef int (*btrfs_changed_cb_t)(struct btrfs_path *left_path,
struct btrfs_path *right_path,
struct btrfs_key *key,
enum btrfs_compare_tree_result result,
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 85a9509a9cbd..d7a8a7aed657 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -6169,9 +6169,7 @@ static int compare_refs(struct send_ctx *sctx, struct btrfs_path *path,
* Updates compare related fields in sctx and simply forwards to the actual
* changed_xxx functions.
*/
-static int changed_cb(struct btrfs_root *left_root,
- struct btrfs_root *right_root,
- struct btrfs_path *left_path,
+static int changed_cb(struct btrfs_path *left_path,
struct btrfs_path *right_path,
struct btrfs_key *key,
enum btrfs_compare_tree_result result,
@@ -6253,8 +6251,8 @@ static int full_send_tree(struct send_ctx *sctx)
slot = path->slots[0];
btrfs_item_key_to_cpu(eb, &found_key, slot);
- ret = changed_cb(send_root, NULL, path, NULL,
- &found_key, BTRFS_COMPARE_TREE_NEW, sctx);
+ ret = changed_cb(path, NULL, &found_key,
+ BTRFS_COMPARE_TREE_NEW, sctx);
if (ret < 0)
goto out;
--
2.7.4
next prev parent reply other threads:[~2017-08-21 9:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-21 9:43 [PATCH 00/10] Unused parameter cleanup Nikolay Borisov
2017-08-21 9:43 ` [PATCH 01/10] btrfs: Remove chunk_objectid parameter of btrfs_alloc_dev_extent Nikolay Borisov
2017-08-21 13:02 ` Timofey Titovets
2017-08-21 9:43 ` [PATCH 02/10] btrfs: remove superfluous chunk_tree argument from btrfs_alloc_dev_extent Nikolay Borisov
2017-08-21 9:43 ` [PATCH 03/10] btrfs: Remove unused variable Nikolay Borisov
2017-08-21 13:06 ` Timofey Titovets
2017-08-21 9:43 ` [PATCH 04/10] btrfs: Remove unused parameters from various functions Nikolay Borisov
2017-08-21 9:43 ` Nikolay Borisov [this message]
2017-08-21 9:43 ` [PATCH 06/10] btrfs: Remove unused parameter from check_direct_IO Nikolay Borisov
2017-08-21 12:25 ` Timofey Titovets
2017-09-07 19:09 ` David Sterba
2017-08-21 9:43 ` [PATCH 07/10] btrfs: Remove unused parameter from extent_clear_unlock_delalloc Nikolay Borisov
2017-09-07 19:20 ` David Sterba
2017-08-21 9:43 ` [PATCH 08/10] btrfs: remove unused parameter in cow_file_range Nikolay Borisov
2017-09-25 12:18 ` Nikolay Borisov
2017-09-25 13:22 ` Qu Wenruo
2017-09-25 13:29 ` David Sterba
2017-08-21 9:43 ` [PATCH 09/10] btrfs: Rework error handling of add_extent_mapping in __btrfs_alloc_chunk Nikolay Borisov
2017-09-07 19:26 ` David Sterba
2017-08-21 9:43 ` [PATCH 10/10] btrfs: Remove redundant argument of __link_block_group Nikolay Borisov
2017-09-07 19:33 ` David Sterba
2017-08-21 17:36 ` [PATCH 00/10] Unused parameter cleanup Josef Bacik
2017-09-07 19:39 ` 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=1503308630-6652-6-git-send-email-nborisov@suse.com \
--to=nborisov@suse.com \
--cc=dsterba@suse.cz \
--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).