Remove some unused struct members
David Sterba
maintainercover Remove some unused struct members
Jiri Slaby wrote a tool to find unused struct members [1]. There are some interesting fossils. Comparing that to my hacky coccinelle scripts, it did a much better job.
[1] https://github.com/jirislaby/clang-struct
David Sterba (5):
btrfs: scrub: remove unused scrub_ctx::sectors_per_bio
btrfs: remove unused btrfs_ordered_extent::outstanding_isize
btrfs: raid56: remove unused btrfs_plug_cb::work
btrfs: remove unused definition of tree_entry in extent-io-tree.c
btrfs: remove unused btrfs_root::type
fs/btrfs/ctree.h | 2 -- fs/btrfs/extent-io-tree.c | 6 ------ fs/btrfs/ordered-data.h | 7 ------- fs/btrfs/raid56.c | 1 - fs/btrfs/scrub.c | 1 - 5 files changed, 17 deletions(-)
Signature · 1 line
2.42.1
David Sterba
maintainerPATCH 1/5 btrfs: scrub: remove unused scrub_ctx::sectors_per_bio
The recent scrub rewrite forgot to remove the sectors_per_bio in 6.3 in 13a62fd997f0 ("btrfs: scrub: remove scrub_bio structure"). This was found by tool https://github.com/jirislaby/clang-struct .
--- fs/btrfs/scrub.c | 1 - 1 file changed, 1 deletion(-)
fs/btrfs/scrub.c +0 -1
@@ -192,7 +192,6 @@ struct scrub_ctx {int cur_stripe;atomic_t cancel_req;int readonly; -int sectors_per_bio;/* State of IO submission throttling affecting the associated device */ ktime_t throttle_deadline;
Signature · 1 line
2.42.1
David Sterba
maintainerPATCH 2/5 btrfs: remove unused btrfs_ordered_extent::outstanding_isize
In reply to David SterbaThe whole isize code was deleted in 5.6 3f1c64ce0438 ("btrfs: delete the ordered isize update code"), except the struct member. This was found by tool https://github.com/jirislaby/clang-struct .
--- fs/btrfs/ordered-data.h | 7 ------- 1 file changed, 7 deletions(-)
fs/btrfs/ordered-data.h +0 -7
@@ -96,13 +96,6 @@ struct btrfs_ordered_extent {/* number of bytes that still need writing */ u64 bytes_left; -/* -* the end of the ordered extent which is behind it but -* didn't update disk_i_size. Please see the comment of -* btrfs_ordered_update_i_size(); -*/ -u64 outstanding_isize; -/* * If we get truncated we need to adjust the file extent we enter for * this ordered extent so that we do not expose stale data.
Signature · 1 line
2.42.1
David Sterba
maintainerPATCH 3/5 btrfs: raid56: remove unused btrfs_plug_cb::work
In reply to David SterbaThe raid56 changes in 6.2 reworked the IO path to RMW, commit 93723095b5d5 ("btrfs: raid56: switch write path to rmw_rbio()") in particular removed the last use of the work member so it can be removed as well. This was found by tool https://github.com/jirislaby/clang-struct .
--- fs/btrfs/raid56.c | 1 - 1 file changed, 1 deletion(-)
fs/btrfs/raid56.c +0 -1
@@ -1549,7 +1549,6 @@ struct btrfs_plug_cb {struct blk_plug_cb cb;struct btrfs_fs_info *info;struct list_head rbio_list; -struct work_struct work; };/*
Signature · 1 line
2.42.1
David Sterba
maintainerPATCH 4/5 btrfs: remove unused definition of tree_entry in extent-io-tree.c
In reply to David SterbaThe declaration was temporarily moved in a4055213bf69 ("btrfs: unexport all the temporary exports for extent-io-tree.c") and then should have been removed in 6.0 in 071d19f5130f ("btrfs: remove struct tree_entry in extent-io-tree.c") but was not. This was found by tool
https://github.com/jirislaby/clang-struct .
--- fs/btrfs/extent-io-tree.c | 6 ------ 1 file changed, 6 deletions(-)
fs/btrfs/extent-io-tree.c +0 -6
@@ -87,12 +87,6 @@ static inline void __btrfs_debug_check_extent_io_range(const char *caller,*/ static struct lock_class_key file_extent_tree_class; -struct tree_entry { -u64 start; -u64 end; -struct rb_node rb_node; -}; -void extent_io_tree_init (struct btrfs_fs_info *fs_info,struct extent_io_tree *tree,unsigned int owner) {
Signature · 1 line
2.42.1
David Sterba
maintainerPATCH 5/5 btrfs: remove unused btrfs_root::type
In reply to David SterbaLooks like the struct member was added in 2007 in 2.6.29 in commit 87ee04eb0f2f ("Btrfs: Add simple stripe size parameter") but hasn't been used at all since. So let's remove it. This was found by tool
https://github.com/jirislaby/clang-struct, then build tested after removing the struct member.
--- fs/btrfs/ctree.h | 2 -- 1 file changed, 2 deletions(-)
fs/btrfs/ctree.h +0 -2
@@ -212,8 +212,6 @@ struct btrfs_root {u64 last_trans; -u32 type; -u64 free_objectid;struct btrfs_key defrag_progress;
Signature · 1 line
2.42.1
Quoted 3 lines · David Sterba
Jiri Slaby wrote a tool to find unused struct members [1]. There are some interesting fossils. Comparing that to my hacky coccinelle scripts, it did a much better job.
Quoted 2 lines
The tool looks awesome!
Thanks,
Qu
Quoted 15 lines
David Sterba (5):
btrfs: scrub: remove unusedscrub_ctx::sectors_per_bio
btrfs: remove unusedbtrfs_ordered_extent::outstanding_isize
btrfs: raid56: remove unusedbtrfs_plug_cb::work
btrfs: remove unused definition oftree_entryinextent-io-tree.c
btrfs: remove unusedbtrfs_root::typefs/btrfs/ctree.h | 2 -- fs/btrfs/extent-io-tree.c | 6 ------ fs/btrfs/ordered-data.h | 7 ------- fs/btrfs/raid56.c | 1 - fs/btrfs/scrub.c | 1 - 5 files changed, 17 deletions(-)
For the patchset.
Looks good,
Quoted 4 lines · David Sterba
Jiri Slaby wrote a tool to find unused struct members [1]. There are some interesting fossils. Comparing that to my hacky coccinelle scripts, it did a much better job.
Quoted 8 lines
[1] https://github.com/jirislaby/clang-struct
David Sterba (5):
btrfs: scrub: remove unusedscrub_ctx::sectors_per_bio
btrfs: remove unusedbtrfs_ordered_extent::outstanding_isize
btrfs: raid56: remove unusedbtrfs_plug_cb::work
btrfs: remove unused definition oftree_entryinextent-io-tree.c
btrfs: remove unusedbtrfs_root::type
Added to misc-next.