public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove unused btrfs_io_stripe::length
@ 2025-04-22 15:32 David Sterba
  2025-04-28 14:49 ` Johannes Thumshirn
  0 siblings, 1 reply; 2+ messages in thread
From: David Sterba @ 2025-04-22 15:32 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

First added (but not effectively used) in 02c372e1f016e5 ("btrfs: add
support for inserting raid stripe extents"). The structure is
initialized to zeros so the only use in btrfs_insert_one_raid_extent()

    u64 length = bioc->stripes[i].length;
    struct btrfs_raid_stride *raid_stride = &stripe_extent->strides[i];

    if (length == 0)
            length = bioc->size;

the 'if' always happens.

Last use in 4016358e852861 ("btrfs: remove unused variable length in
btrfs_insert_one_raid_extent()") was an obvious cleanup. It seems to be
safe to remove, raid-stripe-tree works without using it since 6.6.

This was found by tool https://github.com/jirislaby/clang-struct .

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/volumes.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 0e793b9776d677..d06d2d8713f87f 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -473,7 +473,6 @@ struct btrfs_io_stripe {
 	struct btrfs_device *dev;
 	/* Block mapping. */
 	u64 physical;
-	u64 length;
 	bool rst_search_commit_root;
 	/* For the endio handler. */
 	struct btrfs_io_context *bioc;
-- 
2.49.0


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

* Re: [PATCH] btrfs: remove unused btrfs_io_stripe::length
  2025-04-22 15:32 [PATCH] btrfs: remove unused btrfs_io_stripe::length David Sterba
@ 2025-04-28 14:49 ` Johannes Thumshirn
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Thumshirn @ 2025-04-28 14:49 UTC (permalink / raw)
  To: David Sterba, linux-btrfs@vger.kernel.org

On 22.04.25 17:36, David Sterba wrote:
> First added (but not effectively used) in 02c372e1f016e5 ("btrfs: add
> support for inserting raid stripe extents"). The structure is
> initialized to zeros so the only use in btrfs_insert_one_raid_extent()
> 
>      u64 length = bioc->stripes[i].length;
>      struct btrfs_raid_stride *raid_stride = &stripe_extent->strides[i];
> 
>      if (length == 0)
>              length = bioc->size;
> 
> the 'if' always happens.
> 
> Last use in 4016358e852861 ("btrfs: remove unused variable length in
> btrfs_insert_one_raid_extent()") was an obvious cleanup. It seems to be
> safe to remove, raid-stripe-tree works without using it since 6.6.
> 
> This was found by tool https://github.com/jirislaby/clang-struct .
> 
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>   fs/btrfs/volumes.h | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
> index 0e793b9776d677..d06d2d8713f87f 100644
> --- a/fs/btrfs/volumes.h
> +++ b/fs/btrfs/volumes.h
> @@ -473,7 +473,6 @@ struct btrfs_io_stripe {
>   	struct btrfs_device *dev;
>   	/* Block mapping. */
>   	u64 physical;
> -	u64 length;
>   	bool rst_search_commit_root;
>   	/* For the endio handler. */
>   	struct btrfs_io_context *bioc;

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

end of thread, other threads:[~2025-04-28 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-22 15:32 [PATCH] btrfs: remove unused btrfs_io_stripe::length David Sterba
2025-04-28 14:49 ` Johannes Thumshirn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox