Skip to contentSkip to conversation

btrfs: remove unused btrfs_io_stripe::length

PATCH In review David Sterba 2 participants 2 messages Apr 22, 2025 – Apr 28, 2025 Btrfs file system

lore
Share & tools
lore

David Sterba

author maintainer
#0 lore raw

PATCH 1/1 btrfs: remove unused btrfs_io_stripe::length

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 .

---
 fs/btrfs/volumes.h | 1 -
 1 file changed, 1 deletion(-)
fs/btrfs/volumes.h +0 -1
index 0e793b9776d677..d06d2d8713f87f 100644
@@ -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;
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · 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 .

---
  fs/btrfs/volumes.h | 1 -
  1 file changed, 1 deletion(-)
fs/btrfs/volumes.h +0 -0
index 0e793b9776d677..d06d2d8713f87f 100644

fs/btrfs/volumes.h struct btrfs_io_stripe { · line 478

Quoted 7 lines
fs/btrfs/volumes.h +0 -1
@@ -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,