linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs-progs: small compile warning fixes
@ 2020-08-26  0:47 Qu Wenruo
  2020-08-26  0:47 ` [PATCH 1/2] btrfs-progs: fix compile warning due to global fs_info cleanup Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Qu Wenruo @ 2020-08-26  0:47 UTC (permalink / raw)
  To: linux-btrfs

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(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] btrfs-progs: fix compile warning due to global fs_info cleanup
  2020-08-26  0:47 [PATCH 0/2] btrfs-progs: small compile warning fixes Qu Wenruo
@ 2020-08-26  0:47 ` Qu Wenruo
  2020-08-26 14:26   ` Josef Bacik
  2020-08-28 16:06   ` David Sterba
  2020-08-26  0:47 ` [PATCH 2/2] btrfs-progs: remove the unused variable in check_chunks_and_extents_lowmem() Qu Wenruo
  2020-08-26 15:31 ` [PATCH 0/2] btrfs-progs: small compile warning fixes David Sterba
  2 siblings, 2 replies; 9+ messages in thread
From: Qu Wenruo @ 2020-08-26  0:47 UTC (permalink / raw)
  To: linux-btrfs

[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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] btrfs-progs: remove the unused variable in check_chunks_and_extents_lowmem()
  2020-08-26  0:47 [PATCH 0/2] btrfs-progs: small compile warning fixes Qu Wenruo
  2020-08-26  0:47 ` [PATCH 1/2] btrfs-progs: fix compile warning due to global fs_info cleanup Qu Wenruo
@ 2020-08-26  0:47 ` Qu Wenruo
  2020-08-26 14:29   ` Josef Bacik
  2020-08-28 16:06   ` David Sterba
  2020-08-26 15:31 ` [PATCH 0/2] btrfs-progs: small compile warning fixes David Sterba
  2 siblings, 2 replies; 9+ messages in thread
From: Qu Wenruo @ 2020-08-26  0:47 UTC (permalink / raw)
  To: linux-btrfs

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 <wqu@suse.com>
---
 check/mode-lowmem.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index 3ce119fa0f61..837bacf920ac 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -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;
 	}
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] btrfs-progs: fix compile warning due to global fs_info cleanup
  2020-08-26  0:47 ` [PATCH 1/2] btrfs-progs: fix compile warning due to global fs_info cleanup Qu Wenruo
@ 2020-08-26 14:26   ` Josef Bacik
  2020-08-28 16:06   ` David Sterba
  1 sibling, 0 replies; 9+ messages in thread
From: Josef Bacik @ 2020-08-26 14:26 UTC (permalink / raw)
  To: Qu Wenruo, linux-btrfs

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] btrfs-progs: remove the unused variable in check_chunks_and_extents_lowmem()
  2020-08-26  0:47 ` [PATCH 2/2] btrfs-progs: remove the unused variable in check_chunks_and_extents_lowmem() Qu Wenruo
@ 2020-08-26 14:29   ` Josef Bacik
  2020-08-28 16:06   ` David Sterba
  1 sibling, 0 replies; 9+ messages in thread
From: Josef Bacik @ 2020-08-26 14:29 UTC (permalink / raw)
  To: Qu Wenruo, linux-btrfs

On 8/25/20 8:47 PM, Qu Wenruo wrote:
> 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 <wqu@suse.com>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] btrfs-progs: small compile warning fixes
  2020-08-26  0:47 [PATCH 0/2] btrfs-progs: small compile warning fixes Qu Wenruo
  2020-08-26  0:47 ` [PATCH 1/2] btrfs-progs: fix compile warning due to global fs_info cleanup Qu Wenruo
  2020-08-26  0:47 ` [PATCH 2/2] btrfs-progs: remove the unused variable in check_chunks_and_extents_lowmem() Qu Wenruo
@ 2020-08-26 15:31 ` David Sterba
  2020-08-26 15:43   ` David Sterba
  2 siblings, 1 reply; 9+ messages in thread
From: David Sterba @ 2020-08-26 15:31 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

On Wed, Aug 26, 2020 at 08:47:32AM +0800, Qu Wenruo wrote:
> Although the global parameter fs_info would affect all repair tests...

Can you please be more specific?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] btrfs-progs: small compile warning fixes
  2020-08-26 15:31 ` [PATCH 0/2] btrfs-progs: small compile warning fixes David Sterba
@ 2020-08-26 15:43   ` David Sterba
  0 siblings, 0 replies; 9+ messages in thread
From: David Sterba @ 2020-08-26 15:43 UTC (permalink / raw)
  To: David Sterba; +Cc: Qu Wenruo, linux-btrfs

On Wed, Aug 26, 2020 at 05:31:12PM +0200, David Sterba wrote:
> On Wed, Aug 26, 2020 at 08:47:32AM +0800, Qu Wenruo wrote:
> > 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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] btrfs-progs: fix compile warning due to global fs_info cleanup
  2020-08-26  0:47 ` [PATCH 1/2] btrfs-progs: fix compile warning due to global fs_info cleanup Qu Wenruo
  2020-08-26 14:26   ` Josef Bacik
@ 2020-08-28 16:06   ` David Sterba
  1 sibling, 0 replies; 9+ messages in thread
From: David Sterba @ 2020-08-28 16:06 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] btrfs-progs: remove the unused variable in check_chunks_and_extents_lowmem()
  2020-08-26  0:47 ` [PATCH 2/2] btrfs-progs: remove the unused variable in check_chunks_and_extents_lowmem() Qu Wenruo
  2020-08-26 14:29   ` Josef Bacik
@ 2020-08-28 16:06   ` David Sterba
  1 sibling, 0 replies; 9+ messages in thread
From: David Sterba @ 2020-08-28 16:06 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

On Wed, Aug 26, 2020 at 08:47:34AM +0800, Qu Wenruo wrote:
> 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 <wqu@suse.com>

Added to devel, thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-08-28 16:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26  0:47 [PATCH 0/2] btrfs-progs: small compile warning fixes Qu Wenruo
2020-08-26  0:47 ` [PATCH 1/2] btrfs-progs: fix compile warning due to global fs_info cleanup Qu Wenruo
2020-08-26 14:26   ` Josef Bacik
2020-08-28 16:06   ` David Sterba
2020-08-26  0:47 ` [PATCH 2/2] btrfs-progs: remove the unused variable in check_chunks_and_extents_lowmem() Qu Wenruo
2020-08-26 14:29   ` Josef Bacik
2020-08-28 16:06   ` David Sterba
2020-08-26 15:31 ` [PATCH 0/2] btrfs-progs: small compile warning fixes David Sterba
2020-08-26 15:43   ` David Sterba

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