Message ID | 20200826004734.89905-2-wqu@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs-progs: small compile warning fixes | expand |
On 8/25/20 8:47 PM, Qu Wenruo wrote: > [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> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Thanks, Josef
On Wed, Aug 26, 2020 at 08:47:33AM +0800, Qu Wenruo wrote: > [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> Thanks, I folded this fix to the original patch as it indeed borked the repair.
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);
[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(-)