Skip to contentSkip to conversation

btrfs-progs: small compile warning fixes

PATCH In review Qu Wenruo 3 participants 9 messages Aug 26, 2020 – Aug 28, 2020 Btrfs file system

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

cover btrfs-progs: small compile warning fixes

Although the global parameter fs_info would affect all repair tests...

Qu Wenruo (2):
btrfs-progs: fix compile warning due to global fs_info cleanup
btrfs-progs: remove the unused variable in
check_chunks_and_extents_lowmem()

 check/mode-lowmem.c         | 15 ++++++---------
 kernel-shared/ctree.h       |  3 +--
 kernel-shared/extent-tree.c |  2 +-
 3 files changed, 8 insertions(+), 12 deletions(-)
Signature · 1 line
2.28.0
author
#1 lore raw

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

[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")
---
 kernel-shared/ctree.h       | 3 +--
 kernel-shared/extent-tree.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
kernel-shared/ctree.h +1 -2
index 78d268e226fd..7683b8bbf0b4 100644
@@ -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;
kernel-shared/extent-tree.c +1 -1
index e29ff433196f..5b1fbe10283a 100644
@@ -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);
 
Signature · 1 line
2.28.0
Reviewed-by on v1 1/2
#2 lore raw

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

Quoted 14 lines · Qu Wenruo

[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.

Quoted 5 lines

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

Fixes b91222b3 ("btrfs-progs: check: drop unused fs_info")

Thanks,

Josef

#3 lore raw

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

In reply to Qu Wenruo
Quoted 14 lines · Qu Wenruo

[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.

Quoted 5 lines

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

Fixes b91222b3 ("btrfs-progs: check: drop unused fs_info")

Thanks, I folded this fix to the original patch as it indeed borked the repair.

author
#4 lore raw

PATCH 2/2 btrfs-progs: remove the unused variable in check_chunks_and_extents_lowmem()

In reply to Qu Wenruo

The variable @root is only set but not utilized, while we only utilize @root1.

Replace @root1 with @root, then remove the @root1.

---
 check/mode-lowmem.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
check/mode-lowmem.c +6 -9
index 3ce119fa0f61..837bacf920ac 100644
@@ -5399,20 +5399,17 @@ int check_chunks_and_extents_lowmem(void)
 	struct btrfs_path path;
 	struct btrfs_key old_key;
 	struct btrfs_key key;
-	struct btrfs_root *root1;
 	struct btrfs_root *root;
 	struct btrfs_root *cur_root;
 	int err = 0;
 	int ret;
 
-	root = gfs_info->fs_root;
-
-	root1 = gfs_info->chunk_root;
-	ret = check_btrfs_root(root1, 1);
+	root = gfs_info->chunk_root;
+	ret = check_btrfs_root(root, 1);
 	err |= ret;
 
-	root1 = gfs_info->tree_root;
-	ret = check_btrfs_root(root1, 1);
+	root = gfs_info->tree_root;
+	ret = check_btrfs_root(root, 1);
 	err |= ret;
 
 	btrfs_init_path(&path);
@@ -5420,7 +5417,7 @@ int check_chunks_and_extents_lowmem(void)
 	key.offset = 0;
 	key.type = BTRFS_ROOT_ITEM_KEY;
 
-	ret = btrfs_search_slot(NULL, root1, &key, &path, 0, 0);
+	ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
 	if (ret) {
 		error("cannot find extent tree in tree_root");
 		goto out;
@@ -5455,7 +5452,7 @@ int check_chunks_and_extents_lowmem(void)
 		if (ret)
 			goto out;
 next:
-		ret = btrfs_next_item(root1, &path);
+		ret = btrfs_next_item(root, &path);
 		if (ret)
 			goto out;
 	}
Signature · 1 line
2.28.0
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] btrfs-progs: remove the unused variable in check_chunks_and_extents_lowmem()

Quoted 6 lines · Qu Wenruo

The variable @root is only set but not utilized, while we only utilize @root1.

Replace @root1 with @root, then remove the @root1.

Thanks,

Josef

#6 lore raw

Re: [PATCH 2/2] btrfs-progs: remove the unused variable in check_chunks_and_extents_lowmem()

In reply to Qu Wenruo
Quoted 6 lines · Qu Wenruo

The variable @root is only set but not utilized, while we only utilize @root1.

Replace @root1 with @root, then remove the @root1.

Added to devel, thanks.

#8 lore raw
Quoted 4 lines · David Sterba
Quoted 1 line · Qu Wenruo

Although the global parameter fs_info would affect all repair tests...

Can you please be more specific?

Ok I see, fsck/013-extent-tree-rebuild test fails.