[PATCH 1/2] btrfs-progs: fix compile warning due to global fs_info cleanup

Qu Wenruo
2020-08-26T00:47:43Z

[BUG]
Compiler gives the following warning:

check/main.c: In function 'check_chunks_and_extents':
check/main.c:8712:30: warning: assignment to 'int (*)(struct btrfs_fs_info *, u64, u64, u64, u64, u64, u64, int)' {aka 'int (*)(struct btrfs_fs_info *, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, int)'} from incompatible pointer type 'int (*)(u64, u64, u64, u64, u64, u64, int)' {aka 'int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, int)'} [-Wincompatible-pointer-types]
8712 | gfs_info->free_extent_hook = free_extent_hook;

And obviously, this would screwup original mode repair.

[CAUSE]
Commit b91222b3 ("btrfs-progs: check: drop unused fs_info") removes the
fs_info parameter for free_extent_hook(), but didn't remove the
parameter for the definition.

[FIX]
Also remove the fs_info parameter for the hook definition.

Fixes: b91222b3 ("btrfs-progs: check: drop unused fs_info")
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
kernel-shared/ctree.h | 3 +--
kernel-shared/extent-tree.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
index 78d268e226fd..7683b8bbf0b4 100644
--- a/kernel-shared/ctree.h
+++ b/kernel-shared/ctree.h
@@ -1201,8 +1201,7 @@ struct btrfs_fs_info {

int transaction_aborted;

- int (*free_extent_hook)(struct btrfs_fs_info *fs_info,
- u64 bytenr, u64 num_bytes, u64 parent,
+ int (*free_extent_hook)(u64 bytenr, u64 num_bytes, u64 parent,
u64 root_objectid, u64 owner, u64 offset,
int refs_to_drop);
struct cache_tree *fsck_extent_cache;
diff --git a/kernel-shared/extent-tree.c b/kernel-shared/extent-tree.c
index e29ff433196f..5b1fbe10283a 100644
--- a/kernel-shared/extent-tree.c
+++ b/kernel-shared/extent-tree.c
@@ -1921,7 +1921,7 @@ static int __free_extent(struct btrfs_trans_handle *trans,
btrfs_fs_incompat(extent_root->fs_info, SKINNY_METADATA);

if (trans->fs_info->free_extent_hook) {
- trans->fs_info->free_extent_hook(trans->fs_info, bytenr, num_bytes,
+ trans->fs_info->free_extent_hook(bytenr, num_bytes,
parent, root_objectid, owner_objectid,
owner_offset, refs_to_drop);

--
2.28.0