All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Remove some unused struct members
@ 2023-11-21  1:50 David Sterba
  2023-11-21  1:50 ` [PATCH 1/5] btrfs: scrub: remove unused scrub_ctx::sectors_per_bio David Sterba
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: David Sterba @ 2023-11-21  1:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba, jirislaby

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

-- 
2.42.1


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

* [PATCH 1/5] btrfs: scrub: remove unused scrub_ctx::sectors_per_bio
  2023-11-21  1:50 [PATCH 0/5] Remove some unused struct members David Sterba
@ 2023-11-21  1:50 ` David Sterba
  2023-11-21  1:50 ` [PATCH 2/5] btrfs: remove unused btrfs_ordered_extent::outstanding_isize David Sterba
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: David Sterba @ 2023-11-21  1:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

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 .

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

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index f62a408671cb..00826644bca8 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -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;
-- 
2.42.1


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

* [PATCH 2/5] btrfs: remove unused btrfs_ordered_extent::outstanding_isize
  2023-11-21  1:50 [PATCH 0/5] Remove some unused struct members David Sterba
  2023-11-21  1:50 ` [PATCH 1/5] btrfs: scrub: remove unused scrub_ctx::sectors_per_bio David Sterba
@ 2023-11-21  1:50 ` David Sterba
  2023-11-21  1:50 ` [PATCH 3/5] btrfs: raid56: remove unused btrfs_plug_cb::work David Sterba
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: David Sterba @ 2023-11-21  1:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

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

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

diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h
index 567a6d3d4712..127ef8bf0ffd 100644
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -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.
-- 
2.42.1


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

* [PATCH 3/5] btrfs: raid56: remove unused btrfs_plug_cb::work
  2023-11-21  1:50 [PATCH 0/5] Remove some unused struct members David Sterba
  2023-11-21  1:50 ` [PATCH 1/5] btrfs: scrub: remove unused scrub_ctx::sectors_per_bio David Sterba
  2023-11-21  1:50 ` [PATCH 2/5] btrfs: remove unused btrfs_ordered_extent::outstanding_isize David Sterba
@ 2023-11-21  1:50 ` David Sterba
  2023-11-21  1:50 ` [PATCH 4/5] btrfs: remove unused definition of tree_entry in extent-io-tree.c David Sterba
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: David Sterba @ 2023-11-21  1:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

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

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

diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 3e014b9370a3..90f12c0e88a1 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -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;
 };
 
 /*
-- 
2.42.1


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

* [PATCH 4/5] btrfs: remove unused definition of tree_entry in extent-io-tree.c
  2023-11-21  1:50 [PATCH 0/5] Remove some unused struct members David Sterba
                   ` (2 preceding siblings ...)
  2023-11-21  1:50 ` [PATCH 3/5] btrfs: raid56: remove unused btrfs_plug_cb::work David Sterba
@ 2023-11-21  1:50 ` David Sterba
  2023-11-21  1:50 ` [PATCH 5/5] btrfs: remove unused btrfs_root::type David Sterba
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: David Sterba @ 2023-11-21  1:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

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

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/extent-io-tree.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c
index ea149be28dff..76061245a46b 100644
--- a/fs/btrfs/extent-io-tree.c
+++ b/fs/btrfs/extent-io-tree.c
@@ -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)
 {
-- 
2.42.1


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

* [PATCH 5/5] btrfs: remove unused btrfs_root::type
  2023-11-21  1:50 [PATCH 0/5] Remove some unused struct members David Sterba
                   ` (3 preceding siblings ...)
  2023-11-21  1:50 ` [PATCH 4/5] btrfs: remove unused definition of tree_entry in extent-io-tree.c David Sterba
@ 2023-11-21  1:50 ` David Sterba
  2023-11-21  3:50 ` [PATCH 0/5] Remove some unused struct members Qu Wenruo
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: David Sterba @ 2023-11-21  1:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

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

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

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 9c0800f5bdcb..54fd4eb92745 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -212,8 +212,6 @@ struct btrfs_root {
 
 	u64 last_trans;
 
-	u32 type;
-
 	u64 free_objectid;
 
 	struct btrfs_key defrag_progress;
-- 
2.42.1


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

* Re: [PATCH 0/5] Remove some unused struct members
  2023-11-21  1:50 [PATCH 0/5] Remove some unused struct members David Sterba
                   ` (4 preceding siblings ...)
  2023-11-21  1:50 ` [PATCH 5/5] btrfs: remove unused btrfs_root::type David Sterba
@ 2023-11-21  3:50 ` Qu Wenruo
  2023-11-21  4:31 ` Anand Jain
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Qu Wenruo @ 2023-11-21  3:50 UTC (permalink / raw)
  To: David Sterba, linux-btrfs; +Cc: jirislaby



On 2023/11/21 12:20, David Sterba wrote:
> 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.

Reviewed-by: Qu Wenruo <wqu@suse.com>

>
> [1] https://github.com/jirislaby/clang-struct

The tool looks awesome!

Thanks,
Qu
>
> 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(-)
>

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

* Re: [PATCH 0/5] Remove some unused struct members
  2023-11-21  1:50 [PATCH 0/5] Remove some unused struct members David Sterba
                   ` (5 preceding siblings ...)
  2023-11-21  3:50 ` [PATCH 0/5] Remove some unused struct members Qu Wenruo
@ 2023-11-21  4:31 ` Anand Jain
  2023-11-21  8:45 ` Johannes Thumshirn
  2023-11-21 13:05 ` David Sterba
  8 siblings, 0 replies; 10+ messages in thread
From: Anand Jain @ 2023-11-21  4:31 UTC (permalink / raw)
  To: David Sterba, linux-btrfs; +Cc: jirislaby

For the patchset.

Reviewed-by: Anand Jain <anand.jain@oracle.com>


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

* Re: [PATCH 0/5] Remove some unused struct members
  2023-11-21  1:50 [PATCH 0/5] Remove some unused struct members David Sterba
                   ` (6 preceding siblings ...)
  2023-11-21  4:31 ` Anand Jain
@ 2023-11-21  8:45 ` Johannes Thumshirn
  2023-11-21 13:05 ` David Sterba
  8 siblings, 0 replies; 10+ messages in thread
From: Johannes Thumshirn @ 2023-11-21  8:45 UTC (permalink / raw)
  To: David Sterba, linux-btrfs@vger.kernel.org; +Cc: jirislaby@kernel.org

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

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

* Re: [PATCH 0/5] Remove some unused struct members
  2023-11-21  1:50 [PATCH 0/5] Remove some unused struct members David Sterba
                   ` (7 preceding siblings ...)
  2023-11-21  8:45 ` Johannes Thumshirn
@ 2023-11-21 13:05 ` David Sterba
  8 siblings, 0 replies; 10+ messages in thread
From: David Sterba @ 2023-11-21 13:05 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs, jirislaby

On Tue, Nov 21, 2023 at 02:50:10AM +0100, David Sterba wrote:
> 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

Added to misc-next.

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

end of thread, other threads:[~2023-11-21 13:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-21  1:50 [PATCH 0/5] Remove some unused struct members David Sterba
2023-11-21  1:50 ` [PATCH 1/5] btrfs: scrub: remove unused scrub_ctx::sectors_per_bio David Sterba
2023-11-21  1:50 ` [PATCH 2/5] btrfs: remove unused btrfs_ordered_extent::outstanding_isize David Sterba
2023-11-21  1:50 ` [PATCH 3/5] btrfs: raid56: remove unused btrfs_plug_cb::work David Sterba
2023-11-21  1:50 ` [PATCH 4/5] btrfs: remove unused definition of tree_entry in extent-io-tree.c David Sterba
2023-11-21  1:50 ` [PATCH 5/5] btrfs: remove unused btrfs_root::type David Sterba
2023-11-21  3:50 ` [PATCH 0/5] Remove some unused struct members Qu Wenruo
2023-11-21  4:31 ` Anand Jain
2023-11-21  8:45 ` Johannes Thumshirn
2023-11-21 13:05 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.