diff mbox series

[3/4] btrfs: remove redundant initialization from btrfs_readahead_tree_block()

Message ID 22e345124a6e35e4dbc07e9564475b5c97b37a41.1729075703.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: some cleanups around read_block_for_search() | expand

Commit Message

Filipe Manana Oct. 16, 2024, 2:20 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

It's pointless to initialize the has_first_key field of the stack local
btrfs_tree_parent_check structure since it all fields not explicitly
initialized are zeroed out, plus it's a bit odd because the field is
of type bool and we are assigning 0 instead of false to it (however it's
not incorrect since 0 is converted to false). Just remove the explicit
initialization due to its redundancy.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/extent_io.c | 1 -
 1 file changed, 1 deletion(-)

Comments

David Sterba Oct. 16, 2024, 3:49 p.m. UTC | #1
On Wed, Oct 16, 2024 at 03:20:22PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> It's pointless to initialize the has_first_key field of the stack local
> btrfs_tree_parent_check structure since it all fields not explicitly
> initialized are zeroed out, plus it's a bit odd because the field is
> of type bool and we are assigning 0 instead of false to it (however it's
> not incorrect since 0 is converted to false). Just remove the explicit
> initialization due to its redundancy.

Makes sense, I've noticed there's one more to remove from
btrfs_qgroup_trace_subtree() you can squash it to this patch too.
Filipe Manana Oct. 16, 2024, 4:41 p.m. UTC | #2
On Wed, Oct 16, 2024 at 4:49 PM David Sterba <dsterba@suse.cz> wrote:
>
> On Wed, Oct 16, 2024 at 03:20:22PM +0100, fdmanana@kernel.org wrote:
> > From: Filipe Manana <fdmanana@suse.com>
> >
> > It's pointless to initialize the has_first_key field of the stack local
> > btrfs_tree_parent_check structure since it all fields not explicitly
> > initialized are zeroed out, plus it's a bit odd because the field is
> > of type bool and we are assigning 0 instead of false to it (however it's
> > not incorrect since 0 is converted to false). Just remove the explicit
> > initialization due to its redundancy.
>
> Makes sense, I've noticed there's one more to remove from
> btrfs_qgroup_trace_subtree() you can squash it to this patch too.

Ah yes, done and added to for-next. Thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 09c0d18a7b5a..0a0c84eb1c42 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -4285,7 +4285,6 @@  void btrfs_readahead_tree_block(struct btrfs_fs_info *fs_info,
 				u64 bytenr, u64 owner_root, u64 gen, int level)
 {
 	struct btrfs_tree_parent_check check = {
-		.has_first_key = 0,
 		.level = level,
 		.transid = gen
 	};