btrfs-progs: small compile warning fixes
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
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.
--- kernel-shared/ctree.h | 3 +-- kernel-shared/extent-tree.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
kernel-shared/ctree.h +1 -2
@@ -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
@@ -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
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 (*)(structbtrfs_fs_info*, u64, u64, u64, u64, u64, u64, int)' {aka 'int (*)(structbtrfs_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]
Commitb91222b3("btrfs-progs: check: drop unusedfs_info") removes thefs_infoparameter forfree_extent_hook(), but didn't remove the parameter for the definition.
Quoted 5 lines
[FIX]
Also remove thefs_infoparameter for the hook definition.Fixes b91222b3 ("btrfs-progs: check: drop unused fs_info")Signed-off-by Qu Wenruo <[email protected]>
Thanks,
Josef
Re: [PATCH 1/2] btrfs-progs: fix compile warning due to global fs_info cleanup
In reply to Qu WenruoQuoted 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 (*)(structbtrfs_fs_info*, u64, u64, u64, u64, u64, u64, int)' {aka 'int (*)(structbtrfs_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]
Commitb91222b3("btrfs-progs: check: drop unusedfs_info") removes thefs_infoparameter forfree_extent_hook(), but didn't remove the parameter for the definition.
Quoted 5 lines
[FIX]
Also remove thefs_infoparameter for the hook definition.Fixes b91222b3 ("btrfs-progs: check: drop unused fs_info")Signed-off-by Qu Wenruo <[email protected]>
Thanks, I folded this fix to the original patch as it indeed borked the repair.
PATCH 2/2 btrfs-progs: remove the unused variable in check_chunks_and_extents_lowmem()
In reply to Qu WenruoThe 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
@@ -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
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.
Signed-off-by Qu Wenruo <[email protected]>
Thanks,
Josef
Re: [PATCH 2/2] btrfs-progs: remove the unused variable in check_chunks_and_extents_lowmem()
In reply to Qu WenruoQuoted 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.
Signed-off-by Qu Wenruo <[email protected]>
Added to devel, thanks.
Quoted 1 line · Qu Wenruo
Although the global parameter
fs_infowould affect all repair tests...
Can you please be more specific?
Quoted 4 lines · David Sterba
Quoted 1 line · Qu Wenruo
Although the global parameter
fs_infowould affect all repair tests...Can you please be more specific?
Ok I see, fsck/013-extent-tree-rebuild test fails.