linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/25] Unused parameter cleanups
@ 2024-10-09 14:30 David Sterba
  2024-10-09 14:30 ` [PATCH 01/25] btrfs: zstd: assert the timer pointer in callback David Sterba
                   ` (25 more replies)
  0 siblings, 26 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Assorted unused parameter removal, I tried to go to history where it was
last used and seemed important. Most of them look like leftovers after
other changes.

David Sterba (25):
  btrfs: zstd: assert the timer pointer in callback
  btrfs: drop unused parameter path from btrfs_tree_mod_log_rewind()
  btrfs: drop unused parameter ctx from batch_delete_dir_index_items()
  btrfs: drop unused parameter fs_info from wait_reserve_ticket()
  btrfs: drop unused parameter fs_info from do_reclaim_sweep()
  btrfs: send: drop unused parameter num from iterate_inode_ref_t
    callbacks
  btrfs: send: drop unused parameter index from iterate_inode_ref_t
    callbacks
  btrfs: scrub: drop unused parameter sctx from
    scrub_submit_extent_sector_read()
  btrfs: drop unused parameter map from scrub_simple_mirror()
  btrfs: qgroup: drop unused parameter fs_info from __del_qgroup_rb()
  btrfs: drop unused transaction parameter from
    btrfs_qgroup_add_swapped_blocks()
  btrfs: lzo: drop unused paramter level from lzo_alloc_workspace()
  btrfs: drop unused parameter argp from btrfs_ioctl_quota_rescan_wait()
  btrfs: drop unused parameter inode from read_inline_extent()
  btrfs: drop unused parameter offset from __cow_file_range_inline()
  btrfs: drop unused parameter file_offset from
    btrfs_encoded_read_regular_fill_pages()
  btrfs: drop unused parameter iov_iter from btrfs_write_check()
  btrfs: drop unused parameter refs from visit_node_for_delete()
  btrfs: drop unused parameter mask from try_release_extent_state()
  btrfs: drop unused parameter fs_info from folio_range_has_eb()
  btrfs: drop unused parameter options from open_ctree()
  btrfs: drop unused parameter data from btrfs_fill_super()
  btrfs: drop unused parameter transaction from alloc_log_tree()
  btrfs: drop unused parameter fs_info from btrfs_match_dir_item_name()
  btrfs: drop unused parameter level from alloc_heuristic_ws()

 fs/btrfs/btrfs_inode.h  |  3 +--
 fs/btrfs/compression.c  |  6 +++---
 fs/btrfs/compression.h  |  2 +-
 fs/btrfs/ctree.c        |  2 +-
 fs/btrfs/dir-item.c     | 11 ++++-------
 fs/btrfs/dir-item.h     |  3 +--
 fs/btrfs/direct-io.c    |  2 +-
 fs/btrfs/disk-io.c      | 10 ++++------
 fs/btrfs/disk-io.h      |  3 +--
 fs/btrfs/extent-tree.c  |  7 +++----
 fs/btrfs/extent_io.c    |  8 ++++----
 fs/btrfs/file.c         |  6 +++---
 fs/btrfs/file.h         |  2 +-
 fs/btrfs/inode.c        | 17 ++++++++---------
 fs/btrfs/ioctl.c        |  5 ++---
 fs/btrfs/lzo.c          |  2 +-
 fs/btrfs/qgroup.c       | 10 ++++------
 fs/btrfs/qgroup.h       |  3 +--
 fs/btrfs/relocation.c   |  2 +-
 fs/btrfs/scrub.c        | 12 +++++-------
 fs/btrfs/send.c         | 25 +++++++------------------
 fs/btrfs/space-info.c   | 10 ++++------
 fs/btrfs/super.c        |  7 +++----
 fs/btrfs/tree-log.c     |  3 +--
 fs/btrfs/tree-mod-log.c |  1 -
 fs/btrfs/tree-mod-log.h |  1 -
 fs/btrfs/xattr.c        |  5 ++---
 fs/btrfs/zstd.c         |  2 ++
 28 files changed, 69 insertions(+), 101 deletions(-)

-- 
2.45.0


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

* [PATCH 01/25] btrfs: zstd: assert the timer pointer in callback
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
@ 2024-10-09 14:30 ` David Sterba
  2024-10-09 14:30 ` [PATCH 02/25] btrfs: drop unused parameter path from btrfs_tree_mod_log_rewind() David Sterba
                   ` (24 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Make sure we got the right timer struct for the zstd workspace reclaim
work.

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

diff --git a/fs/btrfs/zstd.c b/fs/btrfs/zstd.c
index 15f8a83165a3..5232b56d5892 100644
--- a/fs/btrfs/zstd.c
+++ b/fs/btrfs/zstd.c
@@ -111,6 +111,8 @@ static void zstd_reclaim_timer_fn(struct timer_list *timer)
 	unsigned long reclaim_threshold = jiffies - ZSTD_BTRFS_RECLAIM_JIFFIES;
 	struct list_head *pos, *next;
 
+	ASSERT(timer == &wsm.timer);
+
 	spin_lock(&wsm.lock);
 
 	if (list_empty(&wsm.lru_list)) {
-- 
2.45.0


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

* [PATCH 02/25] btrfs: drop unused parameter path from btrfs_tree_mod_log_rewind()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
  2024-10-09 14:30 ` [PATCH 01/25] btrfs: zstd: assert the timer pointer in callback David Sterba
@ 2024-10-09 14:30 ` David Sterba
  2024-10-09 14:30 ` [PATCH 03/25] btrfs: drop unused parameter ctx from batch_delete_dir_index_items() David Sterba
                   ` (23 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The path parameter was used for our own locking, that got converted to
rwsem eventually. Last usage in ac5887c8e013d6 ("btrfs: locking: remove
all the blocking helpers").

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ctree.c        | 2 +-
 fs/btrfs/tree-mod-log.c | 1 -
 fs/btrfs/tree-mod-log.h | 1 -
 3 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 0cc919d15b14..b11ec86102e3 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -2334,7 +2334,7 @@ int btrfs_search_old_slot(struct btrfs_root *root, const struct btrfs_key *key,
 
 		level = btrfs_header_level(b);
 		btrfs_tree_read_lock(b);
-		b = btrfs_tree_mod_log_rewind(fs_info, p, b, time_seq);
+		b = btrfs_tree_mod_log_rewind(fs_info, b, time_seq);
 		if (!b) {
 			ret = -ENOMEM;
 			goto done;
diff --git a/fs/btrfs/tree-mod-log.c b/fs/btrfs/tree-mod-log.c
index b382a4c443d4..1ac2678fc4ca 100644
--- a/fs/btrfs/tree-mod-log.c
+++ b/fs/btrfs/tree-mod-log.c
@@ -909,7 +909,6 @@ static void tree_mod_log_rewind(struct btrfs_fs_info *fs_info,
  * is freed (its refcount is decremented).
  */
 struct extent_buffer *btrfs_tree_mod_log_rewind(struct btrfs_fs_info *fs_info,
-						struct btrfs_path *path,
 						struct extent_buffer *eb,
 						u64 time_seq)
 {
diff --git a/fs/btrfs/tree-mod-log.h b/fs/btrfs/tree-mod-log.h
index 6308c577a4a4..1c12566040db 100644
--- a/fs/btrfs/tree-mod-log.h
+++ b/fs/btrfs/tree-mod-log.h
@@ -41,7 +41,6 @@ int btrfs_tree_mod_log_insert_key(const struct extent_buffer *eb, int slot,
 				  enum btrfs_mod_log_op op);
 int btrfs_tree_mod_log_free_eb(struct extent_buffer *eb);
 struct extent_buffer *btrfs_tree_mod_log_rewind(struct btrfs_fs_info *fs_info,
-						struct btrfs_path *path,
 						struct extent_buffer *eb,
 						u64 time_seq);
 struct extent_buffer *btrfs_get_old_root(struct btrfs_root *root, u64 time_seq);
-- 
2.45.0


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

* [PATCH 03/25] btrfs: drop unused parameter ctx from batch_delete_dir_index_items()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
  2024-10-09 14:30 ` [PATCH 01/25] btrfs: zstd: assert the timer pointer in callback David Sterba
  2024-10-09 14:30 ` [PATCH 02/25] btrfs: drop unused parameter path from btrfs_tree_mod_log_rewind() David Sterba
@ 2024-10-09 14:30 ` David Sterba
  2024-10-09 14:31 ` [PATCH 04/25] btrfs: drop unused parameter fs_info from wait_reserve_ticket() David Sterba
                   ` (22 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The ctx parameter is not used, we can drop it.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/tree-log.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index e2ed2a791f8f..d76f9293189e 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -6204,7 +6204,6 @@ static int log_delayed_deletions_full(struct btrfs_trans_handle *trans,
 static int batch_delete_dir_index_items(struct btrfs_trans_handle *trans,
 					struct btrfs_inode *inode,
 					struct btrfs_path *path,
-					struct btrfs_log_ctx *ctx,
 					const struct list_head *delayed_del_list,
 					const struct btrfs_delayed_item *first,
 					const struct btrfs_delayed_item **last_ret)
@@ -6265,7 +6264,7 @@ static int log_delayed_deletions_incremental(struct btrfs_trans_handle *trans,
 		if (ret < 0) {
 			return ret;
 		} else if (ret == 0) {
-			ret = batch_delete_dir_index_items(trans, inode, path, ctx,
+			ret = batch_delete_dir_index_items(trans, inode, path,
 							   delayed_del_list, curr,
 							   &last);
 			if (ret)
-- 
2.45.0


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

* [PATCH 04/25] btrfs: drop unused parameter fs_info from wait_reserve_ticket()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (2 preceding siblings ...)
  2024-10-09 14:30 ` [PATCH 03/25] btrfs: drop unused parameter ctx from batch_delete_dir_index_items() David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 05/25] btrfs: drop unused parameter fs_info from do_reclaim_sweep() David Sterba
                   ` (21 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The parameter is not used, we can also reach it from the space info if
needed in the future.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/space-info.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index ee23fae73f47..3c7ccb3935cf 100644
--- a/fs/btrfs/space-info.c
+++ b/fs/btrfs/space-info.c
@@ -1488,8 +1488,7 @@ static void priority_reclaim_data_space(struct btrfs_fs_info *fs_info,
 	spin_unlock(&space_info->lock);
 }
 
-static void wait_reserve_ticket(struct btrfs_fs_info *fs_info,
-				struct btrfs_space_info *space_info,
+static void wait_reserve_ticket(struct btrfs_space_info *space_info,
 				struct reserve_ticket *ticket)
 
 {
@@ -1547,7 +1546,7 @@ static int handle_reserve_ticket(struct btrfs_fs_info *fs_info,
 	case BTRFS_RESERVE_FLUSH_DATA:
 	case BTRFS_RESERVE_FLUSH_ALL:
 	case BTRFS_RESERVE_FLUSH_ALL_STEAL:
-		wait_reserve_ticket(fs_info, space_info, ticket);
+		wait_reserve_ticket(space_info, ticket);
 		break;
 	case BTRFS_RESERVE_FLUSH_LIMIT:
 		priority_reclaim_metadata_space(fs_info, space_info, ticket,
-- 
2.45.0


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

* [PATCH 05/25] btrfs: drop unused parameter fs_info from do_reclaim_sweep()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (3 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 04/25] btrfs: drop unused parameter fs_info from wait_reserve_ticket() David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 06/25] btrfs: send: drop unused parameter num from iterate_inode_ref_t callbacks David Sterba
                   ` (20 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The parameter is unused and we can get it from space info if needed.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/space-info.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index 3c7ccb3935cf..255e85f78313 100644
--- a/fs/btrfs/space-info.c
+++ b/fs/btrfs/space-info.c
@@ -1983,8 +1983,7 @@ static bool is_reclaim_urgent(struct btrfs_space_info *space_info)
 	return unalloc < data_chunk_size;
 }
 
-static void do_reclaim_sweep(const struct btrfs_fs_info *fs_info,
-			     struct btrfs_space_info *space_info, int raid)
+static void do_reclaim_sweep(struct btrfs_space_info *space_info, int raid)
 {
 	struct btrfs_block_group *bg;
 	int thresh_pct;
@@ -2080,6 +2079,6 @@ void btrfs_reclaim_sweep(const struct btrfs_fs_info *fs_info)
 		if (!btrfs_should_periodic_reclaim(space_info))
 			continue;
 		for (raid = 0; raid < BTRFS_NR_RAID_TYPES; raid++)
-			do_reclaim_sweep(fs_info, space_info, raid);
+			do_reclaim_sweep(space_info, raid);
 	}
 }
-- 
2.45.0


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

* [PATCH 06/25] btrfs: send: drop unused parameter num from iterate_inode_ref_t callbacks
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (4 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 05/25] btrfs: drop unused parameter fs_info from do_reclaim_sweep() David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 07/25] btrfs: send: drop unused parameter index " David Sterba
                   ` (19 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

None of the ref iteration callbacks needs the num parameter (this is for
the directory item iteration), so we can drop it.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/send.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 27306d98ec43..18aecef3567d 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -980,7 +980,7 @@ static int get_inode_gen(struct btrfs_root *root, u64 ino, u64 *gen)
 	return ret;
 }
 
-typedef int (*iterate_inode_ref_t)(int num, u64 dir, int index,
+typedef int (*iterate_inode_ref_t)(u64 dir, int index,
 				   struct fs_path *p,
 				   void *ctx);
 
@@ -1007,7 +1007,6 @@ static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path,
 	u32 name_len;
 	char *start;
 	int ret = 0;
-	int num = 0;
 	int index;
 	u64 dir;
 	unsigned long name_off;
@@ -1094,10 +1093,9 @@ static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path,
 		}
 
 		cur += elem_size + name_len;
-		ret = iterate(num, dir, index, p, ctx);
+		ret = iterate(dir, index, p, ctx);
 		if (ret)
 			goto out;
-		num++;
 	}
 
 out:
@@ -1227,7 +1225,7 @@ static int iterate_dir_item(struct btrfs_root *root, struct btrfs_path *path,
 	return ret;
 }
 
-static int __copy_first_ref(int num, u64 dir, int index,
+static int __copy_first_ref(u64 dir, int index,
 			    struct fs_path *p, void *ctx)
 {
 	int ret;
@@ -4708,7 +4706,7 @@ static int record_ref_in_tree(struct rb_root *root, struct list_head *refs,
 	return ret;
 }
 
-static int record_new_ref_if_needed(int num, u64 dir, int index,
+static int record_new_ref_if_needed(u64 dir, int index,
 				    struct fs_path *name, void *ctx)
 {
 	int ret = 0;
@@ -4738,7 +4736,7 @@ static int record_new_ref_if_needed(int num, u64 dir, int index,
 	return ret;
 }
 
-static int record_deleted_ref_if_needed(int num, u64 dir, int index,
+static int record_deleted_ref_if_needed(u64 dir, int index,
 					struct fs_path *name, void *ctx)
 {
 	int ret = 0;
-- 
2.45.0


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

* [PATCH 07/25] btrfs: send: drop unused parameter index from iterate_inode_ref_t callbacks
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (5 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 06/25] btrfs: send: drop unused parameter num from iterate_inode_ref_t callbacks David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 08/25] btrfs: scrub: drop unused parameter sctx from scrub_submit_extent_sector_read() David Sterba
                   ` (18 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

None of the ref iteration callbacks needs the index parameter (this is
for the directory item iteration), so we can drop it.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/send.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 18aecef3567d..db16879c798f 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -980,9 +980,7 @@ static int get_inode_gen(struct btrfs_root *root, u64 ino, u64 *gen)
 	return ret;
 }
 
-typedef int (*iterate_inode_ref_t)(u64 dir, int index,
-				   struct fs_path *p,
-				   void *ctx);
+typedef int (*iterate_inode_ref_t)(u64 dir, struct fs_path *p, void *ctx);
 
 /*
  * Helper function to iterate the entries in ONE btrfs_inode_ref or
@@ -1007,7 +1005,6 @@ static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path,
 	u32 name_len;
 	char *start;
 	int ret = 0;
-	int index;
 	u64 dir;
 	unsigned long name_off;
 	unsigned long elem_size;
@@ -1042,13 +1039,11 @@ static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path,
 			iref = (struct btrfs_inode_ref *)(ptr + cur);
 			name_len = btrfs_inode_ref_name_len(eb, iref);
 			name_off = (unsigned long)(iref + 1);
-			index = btrfs_inode_ref_index(eb, iref);
 			dir = found_key->offset;
 		} else {
 			extref = (struct btrfs_inode_extref *)(ptr + cur);
 			name_len = btrfs_inode_extref_name_len(eb, extref);
 			name_off = (unsigned long)&extref->name;
-			index = btrfs_inode_extref_index(eb, extref);
 			dir = btrfs_inode_extref_parent(eb, extref);
 		}
 
@@ -1093,7 +1088,7 @@ static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path,
 		}
 
 		cur += elem_size + name_len;
-		ret = iterate(dir, index, p, ctx);
+		ret = iterate(dir, p, ctx);
 		if (ret)
 			goto out;
 	}
@@ -1225,8 +1220,7 @@ static int iterate_dir_item(struct btrfs_root *root, struct btrfs_path *path,
 	return ret;
 }
 
-static int __copy_first_ref(u64 dir, int index,
-			    struct fs_path *p, void *ctx)
+static int __copy_first_ref(u64 dir, struct fs_path *p, void *ctx)
 {
 	int ret;
 	struct fs_path *pt = ctx;
@@ -4706,8 +4700,7 @@ static int record_ref_in_tree(struct rb_root *root, struct list_head *refs,
 	return ret;
 }
 
-static int record_new_ref_if_needed(u64 dir, int index,
-				    struct fs_path *name, void *ctx)
+static int record_new_ref_if_needed(u64 dir, struct fs_path *name, void *ctx)
 {
 	int ret = 0;
 	struct send_ctx *sctx = ctx;
@@ -4736,8 +4729,7 @@ static int record_new_ref_if_needed(u64 dir, int index,
 	return ret;
 }
 
-static int record_deleted_ref_if_needed(u64 dir, int index,
-					struct fs_path *name, void *ctx)
+static int record_deleted_ref_if_needed(u64 dir, struct fs_path *name, void *ctx)
 {
 	int ret = 0;
 	struct send_ctx *sctx = ctx;
-- 
2.45.0


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

* [PATCH 08/25] btrfs: scrub: drop unused parameter sctx from scrub_submit_extent_sector_read()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (6 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 07/25] btrfs: send: drop unused parameter index " David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 09/25] btrfs: drop unused parameter map from scrub_simple_mirror() David Sterba
                   ` (17 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The parameter is unused and we can reach sctx from scrub stripe if
needed.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/scrub.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 52e09f307462..f21fc6cf07c0 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1656,8 +1656,7 @@ static u32 stripe_length(const struct scrub_stripe *stripe)
 		   stripe->bg->start + stripe->bg->length - stripe->logical);
 }
 
-static void scrub_submit_extent_sector_read(struct scrub_ctx *sctx,
-					    struct scrub_stripe *stripe)
+static void scrub_submit_extent_sector_read(struct scrub_stripe *stripe)
 {
 	struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
 	struct btrfs_bio *bbio = NULL;
@@ -1753,7 +1752,7 @@ static void scrub_submit_initial_read(struct scrub_ctx *sctx,
 	ASSERT(test_bit(SCRUB_STRIPE_FLAG_INITIALIZED, &stripe->state));
 
 	if (btrfs_need_stripe_tree_update(fs_info, stripe->bg->flags)) {
-		scrub_submit_extent_sector_read(sctx, stripe);
+		scrub_submit_extent_sector_read(stripe);
 		return;
 	}
 
-- 
2.45.0


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

* [PATCH 09/25] btrfs: drop unused parameter map from scrub_simple_mirror()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (7 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 08/25] btrfs: scrub: drop unused parameter sctx from scrub_submit_extent_sector_read() David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 10/25] btrfs: qgroup: drop unused parameter fs_info from __del_qgroup_rb() David Sterba
                   ` (16 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The parameter map used to be passed to scrub_extent() until
e02ee89baa66c4 ("btrfs: scrub: switch scrub_simple_mirror() to
scrub_stripe infrastructure"), where the scrub implementation was
completely reworked.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/scrub.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index f21fc6cf07c0..204c928beaf9 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -2112,7 +2112,6 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
  */
 static int scrub_simple_mirror(struct scrub_ctx *sctx,
 			       struct btrfs_block_group *bg,
-			       struct btrfs_chunk_map *map,
 			       u64 logical_start, u64 logical_length,
 			       struct btrfs_device *device,
 			       u64 physical, int mirror_num)
@@ -2231,7 +2230,7 @@ static int scrub_simple_stripe(struct scrub_ctx *sctx,
 		 * just RAID1, so we can reuse scrub_simple_mirror() to scrub
 		 * this stripe.
 		 */
-		ret = scrub_simple_mirror(sctx, bg, map, cur_logical,
+		ret = scrub_simple_mirror(sctx, bg, cur_logical,
 					  BTRFS_STRIPE_LEN, device, cur_physical,
 					  mirror_num);
 		if (ret)
@@ -2315,7 +2314,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
 		 * Only @physical and @mirror_num needs to calculated using
 		 * @stripe_index.
 		 */
-		ret = scrub_simple_mirror(sctx, bg, map, bg->start, bg->length,
+		ret = scrub_simple_mirror(sctx, bg, bg->start, bg->length,
 				scrub_dev, map->stripes[stripe_index].physical,
 				stripe_index + 1);
 		offset = 0;
@@ -2370,7 +2369,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
 		 * We can reuse scrub_simple_mirror() here, as the repair part
 		 * is still based on @mirror_num.
 		 */
-		ret = scrub_simple_mirror(sctx, bg, map, logical, BTRFS_STRIPE_LEN,
+		ret = scrub_simple_mirror(sctx, bg, logical, BTRFS_STRIPE_LEN,
 					  scrub_dev, physical, 1);
 		if (ret < 0)
 			goto out;
-- 
2.45.0


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

* [PATCH 10/25] btrfs: qgroup: drop unused parameter fs_info from __del_qgroup_rb()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (8 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 09/25] btrfs: drop unused parameter map from scrub_simple_mirror() David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 11/25] btrfs: drop unused transaction parameter from btrfs_qgroup_add_swapped_blocks() David Sterba
                   ` (15 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

We don't need fs_info here, everything is reachable from qgroup.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/qgroup.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 716f29717d5a..b2d421b4cd5a 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -226,8 +226,7 @@ static struct btrfs_qgroup *add_qgroup_rb(struct btrfs_fs_info *fs_info,
 	return qgroup;
 }
 
-static void __del_qgroup_rb(struct btrfs_fs_info *fs_info,
-			    struct btrfs_qgroup *qgroup)
+static void __del_qgroup_rb(struct btrfs_qgroup *qgroup)
 {
 	struct btrfs_qgroup_list *list;
 
@@ -258,7 +257,7 @@ static int del_qgroup_rb(struct btrfs_fs_info *fs_info, u64 qgroupid)
 		return -ENOENT;
 
 	rb_erase(&qgroup->node, &fs_info->qgroup_tree);
-	__del_qgroup_rb(fs_info, qgroup);
+	__del_qgroup_rb(qgroup);
 	return 0;
 }
 
@@ -643,7 +642,7 @@ void btrfs_free_qgroup_config(struct btrfs_fs_info *fs_info)
 	while ((n = rb_first(&fs_info->qgroup_tree))) {
 		qgroup = rb_entry(n, struct btrfs_qgroup, node);
 		rb_erase(n, &fs_info->qgroup_tree);
-		__del_qgroup_rb(fs_info, qgroup);
+		__del_qgroup_rb(qgroup);
 		btrfs_sysfs_del_one_qgroup(fs_info, qgroup);
 		kfree(qgroup);
 	}
-- 
2.45.0


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

* [PATCH 11/25] btrfs: drop unused transaction parameter from btrfs_qgroup_add_swapped_blocks()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (9 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 10/25] btrfs: qgroup: drop unused parameter fs_info from __del_qgroup_rb() David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 12/25] btrfs: lzo: drop unused paramter level from lzo_alloc_workspace() David Sterba
                   ` (14 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The caller replace_path() runs under transaction but we don't need it in
btrfs_qgroup_add_swapped_blocks().

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/qgroup.c     | 3 +--
 fs/btrfs/qgroup.h     | 3 +--
 fs/btrfs/relocation.c | 2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index b2d421b4cd5a..0fcf6e91616e 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -4692,8 +4692,7 @@ void btrfs_qgroup_clean_swapped_blocks(struct btrfs_root *root)
  *			BOTH POINTERS ARE BEFORE TREE SWAP
  * @last_snapshot:	last snapshot generation of the subvolume tree
  */
-int btrfs_qgroup_add_swapped_blocks(struct btrfs_trans_handle *trans,
-		struct btrfs_root *subvol_root,
+int btrfs_qgroup_add_swapped_blocks(struct btrfs_root *subvol_root,
 		struct btrfs_block_group *bg,
 		struct extent_buffer *subvol_parent, int subvol_slot,
 		struct extent_buffer *reloc_parent, int reloc_slot,
diff --git a/fs/btrfs/qgroup.h b/fs/btrfs/qgroup.h
index 5ba2b181636b..9fbd008749fa 100644
--- a/fs/btrfs/qgroup.h
+++ b/fs/btrfs/qgroup.h
@@ -437,8 +437,7 @@ void btrfs_qgroup_init_swapped_blocks(
 	struct btrfs_qgroup_swapped_blocks *swapped_blocks);
 
 void btrfs_qgroup_clean_swapped_blocks(struct btrfs_root *root);
-int btrfs_qgroup_add_swapped_blocks(struct btrfs_trans_handle *trans,
-		struct btrfs_root *subvol_root,
+int btrfs_qgroup_add_swapped_blocks(struct btrfs_root *subvol_root,
 		struct btrfs_block_group *bg,
 		struct extent_buffer *subvol_parent, int subvol_slot,
 		struct extent_buffer *reloc_parent, int reloc_slot,
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index f3834f8d26b4..bf267bdfa8f8 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1244,7 +1244,7 @@ int replace_path(struct btrfs_trans_handle *trans, struct reloc_control *rc,
 		 * The real subtree rescan is delayed until we have new
 		 * CoW on the subtree root node before transaction commit.
 		 */
-		ret = btrfs_qgroup_add_swapped_blocks(trans, dest,
+		ret = btrfs_qgroup_add_swapped_blocks(dest,
 				rc->block_group, parent, slot,
 				path->nodes[level], path->slots[level],
 				last_snapshot);
-- 
2.45.0


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

* [PATCH 12/25] btrfs: lzo: drop unused paramter level from lzo_alloc_workspace()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (10 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 11/25] btrfs: drop unused transaction parameter from btrfs_qgroup_add_swapped_blocks() David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 13/25] btrfs: drop unused parameter argp from btrfs_ioctl_quota_rescan_wait() David Sterba
                   ` (13 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The LZO compression has only one level, we don't need to pass the
parameter.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/compression.c | 2 +-
 fs/btrfs/compression.h | 2 +-
 fs/btrfs/lzo.c         | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 6e9c4a5e0d51..655e3212b409 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -746,7 +746,7 @@ static struct list_head *alloc_workspace(int type, unsigned int level)
 	switch (type) {
 	case BTRFS_COMPRESS_NONE: return alloc_heuristic_ws(level);
 	case BTRFS_COMPRESS_ZLIB: return zlib_alloc_workspace(level);
-	case BTRFS_COMPRESS_LZO:  return lzo_alloc_workspace(level);
+	case BTRFS_COMPRESS_LZO:  return lzo_alloc_workspace();
 	case BTRFS_COMPRESS_ZSTD: return zstd_alloc_workspace(level);
 	default:
 		/*
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
index b6563b6a333e..954034086d0d 100644
--- a/fs/btrfs/compression.h
+++ b/fs/btrfs/compression.h
@@ -175,7 +175,7 @@ int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb);
 int lzo_decompress(struct list_head *ws, const u8 *data_in,
 		struct folio *dest_folio, unsigned long dest_pgoff, size_t srclen,
 		size_t destlen);
-struct list_head *lzo_alloc_workspace(unsigned int level);
+struct list_head *lzo_alloc_workspace(void);
 void lzo_free_workspace(struct list_head *ws);
 
 int zstd_compress_folios(struct list_head *ws, struct address_space *mapping,
diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c
index 72856f6775f7..a45bc11f8665 100644
--- a/fs/btrfs/lzo.c
+++ b/fs/btrfs/lzo.c
@@ -80,7 +80,7 @@ void lzo_free_workspace(struct list_head *ws)
 	kfree(workspace);
 }
 
-struct list_head *lzo_alloc_workspace(unsigned int level)
+struct list_head *lzo_alloc_workspace(void)
 {
 	struct workspace *workspace;
 
-- 
2.45.0


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

* [PATCH 13/25] btrfs: drop unused parameter argp from btrfs_ioctl_quota_rescan_wait()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (11 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 12/25] btrfs: lzo: drop unused paramter level from lzo_alloc_workspace() David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 14/25] btrfs: drop unused parameter inode from read_inline_extent() David Sterba
                   ` (12 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

We don't need the user passed parameter, rescan is a filesystem
operation so fs_info is sufficient.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ioctl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 226c91fe31a7..28b9b7fda578 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4058,8 +4058,7 @@ static long btrfs_ioctl_quota_rescan_status(struct btrfs_fs_info *fs_info,
 	return 0;
 }
 
-static long btrfs_ioctl_quota_rescan_wait(struct btrfs_fs_info *fs_info,
-						void __user *arg)
+static long btrfs_ioctl_quota_rescan_wait(struct btrfs_fs_info *fs_info)
 {
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
@@ -4812,7 +4811,7 @@ long btrfs_ioctl(struct file *file, unsigned int
 	case BTRFS_IOC_QUOTA_RESCAN_STATUS:
 		return btrfs_ioctl_quota_rescan_status(fs_info, argp);
 	case BTRFS_IOC_QUOTA_RESCAN_WAIT:
-		return btrfs_ioctl_quota_rescan_wait(fs_info, argp);
+		return btrfs_ioctl_quota_rescan_wait(fs_info);
 	case BTRFS_IOC_DEV_REPLACE:
 		return btrfs_ioctl_dev_replace(fs_info, argp);
 	case BTRFS_IOC_GET_SUPPORTED_FEATURES:
-- 
2.45.0


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

* [PATCH 14/25] btrfs: drop unused parameter inode from read_inline_extent()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (12 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 13/25] btrfs: drop unused parameter argp from btrfs_ioctl_quota_rescan_wait() David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 15/25] btrfs: drop unused parameter offset from __cow_file_range_inline() David Sterba
                   ` (11 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

We don't need the inode pointer to read inline extent, it's all
accessible from the path pointer.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/inode.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index b0ad46b734c3..1941939f3e48 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6737,8 +6737,7 @@ static noinline int uncompress_inline(struct btrfs_path *path,
 	return ret;
 }
 
-static int read_inline_extent(struct btrfs_inode *inode, struct btrfs_path *path,
-			      struct folio *folio)
+static int read_inline_extent(struct btrfs_path *path, struct folio *folio)
 {
 	struct btrfs_file_extent_item *fi;
 	void *kaddr;
@@ -6936,7 +6935,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
 		ASSERT(em->disk_bytenr == EXTENT_MAP_INLINE);
 		ASSERT(em->len == fs_info->sectorsize);
 
-		ret = read_inline_extent(inode, path, folio);
+		ret = read_inline_extent(path, folio);
 		if (ret < 0)
 			goto out;
 		goto insert;
-- 
2.45.0


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

* [PATCH 15/25] btrfs: drop unused parameter offset from __cow_file_range_inline()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (13 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 14/25] btrfs: drop unused parameter inode from read_inline_extent() David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 16/25] btrfs: drop unused parameter file_offset from btrfs_encoded_read_regular_fill_pages() David Sterba
                   ` (10 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

We don't need offset for inline extents, they always start from 0.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/inode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1941939f3e48..a865ae8e88b9 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -646,7 +646,7 @@ static bool can_cow_file_range_inline(struct btrfs_inode *inode,
  * If being used directly, you must have already checked we're allowed to cow
  * the range by getting true from can_cow_file_range_inline().
  */
-static noinline int __cow_file_range_inline(struct btrfs_inode *inode, u64 offset,
+static noinline int __cow_file_range_inline(struct btrfs_inode *inode,
 					    u64 size, size_t compressed_size,
 					    int compress_type,
 					    struct folio *compressed_folio,
@@ -736,7 +736,7 @@ static noinline int cow_file_range_inline(struct btrfs_inode *inode,
 		return 1;
 
 	lock_extent(&inode->io_tree, offset, end, &cached);
-	ret = __cow_file_range_inline(inode, offset, size, compressed_size,
+	ret = __cow_file_range_inline(inode, size, compressed_size,
 				      compress_type, compressed_folio,
 				      update_i_size);
 	if (ret > 0) {
@@ -9527,7 +9527,7 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
 	if (encoded->unencoded_len == encoded->len &&
 	    encoded->unencoded_offset == 0 &&
 	    can_cow_file_range_inline(inode, start, encoded->len, orig_count)) {
-		ret = __cow_file_range_inline(inode, start, encoded->len,
+		ret = __cow_file_range_inline(inode, encoded->len,
 					      orig_count, compression, folios[0],
 					      true);
 		if (ret <= 0) {
-- 
2.45.0


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

* [PATCH 16/25] btrfs: drop unused parameter file_offset from btrfs_encoded_read_regular_fill_pages()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (14 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 15/25] btrfs: drop unused parameter offset from __cow_file_range_inline() David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 17/25] btrfs: drop unused parameter iov_iter from btrfs_write_check() David Sterba
                   ` (9 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The file_offset parameter used to be passed to encoded read struct but
was removed in commit b665affe93d8 ("btrfs: remove unused members from
struct btrfs_encoded_read_private").

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/btrfs_inode.h | 3 +--
 fs/btrfs/inode.c       | 6 +++---
 fs/btrfs/send.c        | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index e152fde888fc..5e2d93c2dfb5 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -613,8 +613,7 @@ int btrfs_writepage_cow_fixup(struct folio *folio);
 int btrfs_encoded_io_compression_from_extent(struct btrfs_fs_info *fs_info,
 					     int compress_type);
 int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode,
-					  u64 file_offset, u64 disk_bytenr,
-					  u64 disk_io_size,
+					  u64 disk_bytenr, u64 disk_io_size,
 					  struct page **pages);
 ssize_t btrfs_encoded_read(struct kiocb *iocb, struct iov_iter *iter,
 			   struct btrfs_ioctl_encoded_io_args *encoded);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index a865ae8e88b9..83ac76a0caef 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -9103,8 +9103,8 @@ static void btrfs_encoded_read_endio(struct btrfs_bio *bbio)
 }
 
 int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode,
-					  u64 file_offset, u64 disk_bytenr,
-					  u64 disk_io_size, struct page **pages)
+					  u64 disk_bytenr, u64 disk_io_size,
+					  struct page **pages)
 {
 	struct btrfs_fs_info *fs_info = inode->root->fs_info;
 	struct btrfs_encoded_read_private priv = {
@@ -9174,7 +9174,7 @@ static ssize_t btrfs_encoded_read_regular(struct kiocb *iocb,
 		goto out;
 		}
 
-	ret = btrfs_encoded_read_regular_fill_pages(inode, start, disk_bytenr,
+	ret = btrfs_encoded_read_regular_fill_pages(inode, disk_bytenr,
 						    disk_io_size, pages);
 	if (ret)
 		goto out;
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index db16879c798f..75bcfbda8d47 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -5667,7 +5667,7 @@ static int send_encoded_extent(struct send_ctx *sctx, struct btrfs_path *path,
 	 * Note that send_buf is a mapping of send_buf_pages, so this is really
 	 * reading into send_buf.
 	 */
-	ret = btrfs_encoded_read_regular_fill_pages(BTRFS_I(inode), offset,
+	ret = btrfs_encoded_read_regular_fill_pages(BTRFS_I(inode),
 						    disk_bytenr, disk_num_bytes,
 						    sctx->send_buf_pages +
 						    (data_offset >> PAGE_SHIFT));
-- 
2.45.0


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

* [PATCH 17/25] btrfs: drop unused parameter iov_iter from btrfs_write_check()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (15 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 16/25] btrfs: drop unused parameter file_offset from btrfs_encoded_read_regular_fill_pages() David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 18/25] btrfs: drop unused parameter refs from visit_node_for_delete() David Sterba
                   ` (8 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The parameter 'from' has never been used since commit b8d8e1fd570a
("btrfs: introduce btrfs_write_check()"), this is for buffered write.
Direct io write needs it so it was probably an interface thing, but we
can drop it.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/direct-io.c | 2 +-
 fs/btrfs/file.c      | 6 +++---
 fs/btrfs/file.h      | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/direct-io.c b/fs/btrfs/direct-io.c
index bd38df5647e3..a7c3e221378d 100644
--- a/fs/btrfs/direct-io.c
+++ b/fs/btrfs/direct-io.c
@@ -834,7 +834,7 @@ ssize_t btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from)
 		return ret;
 	}
 
-	ret = btrfs_write_check(iocb, from, ret);
+	ret = btrfs_write_check(iocb, ret);
 	if (ret < 0) {
 		btrfs_inode_unlock(BTRFS_I(inode), ilock_flags);
 		goto out;
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 160d77f8eb6f..033f85ea8c9d 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1144,7 +1144,7 @@ static void update_time_for_write(struct inode *inode)
 		inode_inc_iversion(inode);
 }
 
-int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from, size_t count)
+int btrfs_write_check(struct kiocb *iocb, size_t count)
 {
 	struct file *file = iocb->ki_filp;
 	struct inode *inode = file_inode(file);
@@ -1222,7 +1222,7 @@ ssize_t btrfs_buffered_write(struct kiocb *iocb, struct iov_iter *i)
 	if (ret <= 0)
 		goto out;
 
-	ret = btrfs_write_check(iocb, i, ret);
+	ret = btrfs_write_check(iocb, ret);
 	if (ret < 0)
 		goto out;
 
@@ -1467,7 +1467,7 @@ static ssize_t btrfs_encoded_write(struct kiocb *iocb, struct iov_iter *from,
 	if (ret || encoded->len == 0)
 		goto out;
 
-	ret = btrfs_write_check(iocb, from, encoded->len);
+	ret = btrfs_write_check(iocb, encoded->len);
 	if (ret < 0)
 		goto out;
 
diff --git a/fs/btrfs/file.h b/fs/btrfs/file.h
index c23d0bf42598..c2ce0ae94a9c 100644
--- a/fs/btrfs/file.h
+++ b/fs/btrfs/file.h
@@ -44,7 +44,7 @@ void btrfs_check_nocow_unlock(struct btrfs_inode *inode);
 bool btrfs_find_delalloc_in_range(struct btrfs_inode *inode, u64 start, u64 end,
 				  struct extent_state **cached_state,
 				  u64 *delalloc_start_ret, u64 *delalloc_end_ret);
-int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from, size_t count);
+int btrfs_write_check(struct kiocb *iocb, size_t count);
 ssize_t btrfs_buffered_write(struct kiocb *iocb, struct iov_iter *i);
 
 #endif
-- 
2.45.0


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

* [PATCH 18/25] btrfs: drop unused parameter refs from visit_node_for_delete()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (16 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 17/25] btrfs: drop unused parameter iov_iter from btrfs_write_check() David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:31 ` [PATCH 19/25] btrfs: drop unused parameter mask from try_release_extent_state() David Sterba
                   ` (7 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The parameter duplicates what can be effectively obtained from
wc->refs[level - 1] and this is what's actually used inside. Added in
commit 2b73c7e761c4 ("btrfs: unify logic to decide if we need to walk
down into a node during snapshot delete").

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

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 79373f0ab6ce..e29024c66edb 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -5270,7 +5270,7 @@ struct walk_control {
  * corrupted file systems must have been caught before calling this function.
  */
 static bool visit_node_for_delete(struct btrfs_root *root, struct walk_control *wc,
-				  struct extent_buffer *eb, u64 refs, u64 flags, int slot)
+				  struct extent_buffer *eb, u64 flags, int slot)
 {
 	struct btrfs_key key;
 	u64 generation;
@@ -5384,7 +5384,7 @@ static noinline void reada_walk_down(struct btrfs_trans_handle *trans,
 			continue;
 
 		/* If we don't need to visit this node don't reada. */
-		if (!visit_node_for_delete(root, wc, eb, refs, flags, slot))
+		if (!visit_node_for_delete(root, wc, eb, flags, slot))
 			continue;
 reada:
 		btrfs_readahead_node_child(eb, slot);
@@ -5737,8 +5737,7 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans,
 
 	/* If we don't have to walk into this node skip it. */
 	if (!visit_node_for_delete(root, wc, path->nodes[level],
-				   wc->refs[level - 1], wc->flags[level - 1],
-				   path->slots[level]))
+				   wc->flags[level - 1], path->slots[level]))
 		goto skip;
 
 	/*
-- 
2.45.0


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

* [PATCH 19/25] btrfs: drop unused parameter mask from try_release_extent_state()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (17 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 18/25] btrfs: drop unused parameter refs from visit_node_for_delete() David Sterba
@ 2024-10-09 14:31 ` David Sterba
  2024-10-09 14:32 ` [PATCH 20/25] btrfs: drop unused parameter fs_info from folio_range_has_eb() David Sterba
                   ` (6 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:31 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The mask parameter used for allocations got unified to GFP_NOFS and
removed from relevant functions in 1d1268004430 ("btrfs: drop gfp from
parameter extent state helpers").

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/extent_io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 9fbc83c76b94..59c47cb8e538 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2381,7 +2381,7 @@ int extent_invalidate_folio(struct extent_io_tree *tree,
  * to drop the page.
  */
 static bool try_release_extent_state(struct extent_io_tree *tree,
-				    struct folio *folio, gfp_t mask)
+				     struct folio *folio)
 {
 	u64 start = folio_pos(folio);
 	u64 end = start + PAGE_SIZE - 1;
@@ -2492,7 +2492,7 @@ bool try_release_extent_mapping(struct folio *folio, gfp_t mask)
 			cond_resched();
 		}
 	}
-	return try_release_extent_state(io_tree, folio, mask);
+	return try_release_extent_state(io_tree, folio);
 }
 
 static void __free_extent_buffer(struct extent_buffer *eb)
-- 
2.45.0


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

* [PATCH 20/25] btrfs: drop unused parameter fs_info from folio_range_has_eb()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (18 preceding siblings ...)
  2024-10-09 14:31 ` [PATCH 19/25] btrfs: drop unused parameter mask from try_release_extent_state() David Sterba
@ 2024-10-09 14:32 ` David Sterba
  2024-10-09 14:32 ` [PATCH 21/25] btrfs: drop unused parameter options from open_ctree() David Sterba
                   ` (5 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:32 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The parameter was added in 8ff8466d29efc2 ("btrfs: support subpage for
extent buffer page release") for page but hasn't been used since, so we
can drop it.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/extent_io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 59c47cb8e538..7b68c9da691b 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2506,7 +2506,7 @@ static int extent_buffer_under_io(const struct extent_buffer *eb)
 		test_bit(EXTENT_BUFFER_DIRTY, &eb->bflags));
 }
 
-static bool folio_range_has_eb(struct btrfs_fs_info *fs_info, struct folio *folio)
+static bool folio_range_has_eb(struct folio *folio)
 {
 	struct btrfs_subpage *subpage;
 
@@ -2580,7 +2580,7 @@ static void detach_extent_buffer_folio(const struct extent_buffer *eb, struct fo
 	 * We can only detach the folio private if there are no other ebs in the
 	 * page range and no unfinished IO.
 	 */
-	if (!folio_range_has_eb(fs_info, folio))
+	if (!folio_range_has_eb(folio))
 		btrfs_detach_subpage(fs_info, folio);
 
 	spin_unlock(&folio->mapping->i_private_lock);
-- 
2.45.0


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

* [PATCH 21/25] btrfs: drop unused parameter options from open_ctree()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (19 preceding siblings ...)
  2024-10-09 14:32 ` [PATCH 20/25] btrfs: drop unused parameter fs_info from folio_range_has_eb() David Sterba
@ 2024-10-09 14:32 ` David Sterba
  2024-10-09 14:32 ` [PATCH 22/25] btrfs: drop unused parameter data from btrfs_fill_super() David Sterba
                   ` (4 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:32 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Since the new mount option parser in commit ad21f15b0f79 ("btrfs:
switch to the new mount API") we don't pass the options like that
anymore.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/disk-io.c | 3 +--
 fs/btrfs/disk-io.h | 3 +--
 fs/btrfs/super.c   | 2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4ad5db619b00..92c7dbeade1c 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3202,8 +3202,7 @@ int btrfs_check_features(struct btrfs_fs_info *fs_info, bool is_rw_mount)
 	return 0;
 }
 
-int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_devices,
-		      const char *options)
+int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_devices)
 {
 	u32 sectorsize;
 	u32 nodesize;
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
index 99af64d3f277..127e31e08347 100644
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -52,8 +52,7 @@ struct extent_buffer *btrfs_find_create_tree_block(
 int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info);
 int btrfs_check_super_csum(struct btrfs_fs_info *fs_info,
 			   const struct btrfs_super_block *disk_sb);
-int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_devices,
-		      const char *options);
+int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_devices);
 void __cold close_ctree(struct btrfs_fs_info *fs_info);
 int btrfs_validate_super(const struct btrfs_fs_info *fs_info,
 			 const struct btrfs_super_block *sb, int mirror_num);
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index e8a5bf4af918..a86fe54cd615 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -962,7 +962,7 @@ static int btrfs_fill_super(struct super_block *sb,
 		return err;
 	}
 
-	err = open_ctree(sb, fs_devices, (char *)data);
+	err = open_ctree(sb, fs_devices);
 	if (err) {
 		btrfs_err(fs_info, "open_ctree failed");
 		return err;
-- 
2.45.0


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

* [PATCH 22/25] btrfs: drop unused parameter data from btrfs_fill_super()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (20 preceding siblings ...)
  2024-10-09 14:32 ` [PATCH 21/25] btrfs: drop unused parameter options from open_ctree() David Sterba
@ 2024-10-09 14:32 ` David Sterba
  2024-10-09 14:32 ` [PATCH 23/25] btrfs: drop unused parameter transaction from alloc_log_tree() David Sterba
                   ` (3 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:32 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The only caller passes NULL, we can drop the parameter. This is since
the new mount option parser done in 3bb17a25bcb09a ("btrfs: add get_tree
callback for new mount API").

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/super.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index a86fe54cd615..a0b463d17c29 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -937,8 +937,7 @@ static int get_default_subvol_objectid(struct btrfs_fs_info *fs_info, u64 *objec
 }
 
 static int btrfs_fill_super(struct super_block *sb,
-			    struct btrfs_fs_devices *fs_devices,
-			    void *data)
+			    struct btrfs_fs_devices *fs_devices)
 {
 	struct inode *inode;
 	struct btrfs_fs_info *fs_info = btrfs_sb(sb);
@@ -1885,7 +1884,7 @@ static int btrfs_get_tree_super(struct fs_context *fc)
 		snprintf(sb->s_id, sizeof(sb->s_id), "%pg", bdev);
 		shrinker_debugfs_rename(sb->s_shrink, "sb-btrfs:%s", sb->s_id);
 		btrfs_sb(sb)->bdev_holder = &btrfs_fs_type;
-		ret = btrfs_fill_super(sb, fs_devices, NULL);
+		ret = btrfs_fill_super(sb, fs_devices);
 	}
 
 	if (ret) {
-- 
2.45.0


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

* [PATCH 23/25] btrfs: drop unused parameter transaction from alloc_log_tree()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (21 preceding siblings ...)
  2024-10-09 14:32 ` [PATCH 22/25] btrfs: drop unused parameter data from btrfs_fill_super() David Sterba
@ 2024-10-09 14:32 ` David Sterba
  2024-10-09 14:32 ` [PATCH 24/25] btrfs: drop unused parameter fs_info from btrfs_match_dir_item_name() David Sterba
                   ` (2 subsequent siblings)
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:32 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The function got split in commit 6ab6ebb76042d3 ("btrfs: split
alloc_log_tree()") and since then transaction parameter has been unused.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/disk-io.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 92c7dbeade1c..a4c8778dd651 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -917,8 +917,7 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
 	return ERR_PTR(ret);
 }
 
-static struct btrfs_root *alloc_log_tree(struct btrfs_trans_handle *trans,
-					 struct btrfs_fs_info *fs_info)
+static struct btrfs_root *alloc_log_tree(struct btrfs_fs_info *fs_info)
 {
 	struct btrfs_root *root;
 
@@ -966,7 +965,7 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
 {
 	struct btrfs_root *log_root;
 
-	log_root = alloc_log_tree(trans, fs_info);
+	log_root = alloc_log_tree(fs_info);
 	if (IS_ERR(log_root))
 		return PTR_ERR(log_root);
 
@@ -992,7 +991,7 @@ int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
 	struct btrfs_inode_item *inode_item;
 	int ret;
 
-	log_root = alloc_log_tree(trans, fs_info);
+	log_root = alloc_log_tree(fs_info);
 	if (IS_ERR(log_root))
 		return PTR_ERR(log_root);
 
-- 
2.45.0


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

* [PATCH 24/25] btrfs: drop unused parameter fs_info from btrfs_match_dir_item_name()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (22 preceding siblings ...)
  2024-10-09 14:32 ` [PATCH 23/25] btrfs: drop unused parameter transaction from alloc_log_tree() David Sterba
@ 2024-10-09 14:32 ` David Sterba
  2024-10-09 14:32 ` [PATCH 25/25] btrfs: drop unused parameter level from alloc_heuristic_ws() David Sterba
  2024-10-11 11:45 ` [PATCH 00/25] Unused parameter cleanups Anand Jain
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:32 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Cascaded removal of fs_info that is not needed in several functions.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/dir-item.c | 11 ++++-------
 fs/btrfs/dir-item.h |  3 +--
 fs/btrfs/send.c     |  3 +--
 fs/btrfs/xattr.c    |  5 ++---
 4 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index 001c0c2f872c..d3093eba54a5 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -27,7 +27,6 @@ static struct btrfs_dir_item *insert_with_overflow(struct btrfs_trans_handle
 						   const char *name,
 						   int name_len)
 {
-	struct btrfs_fs_info *fs_info = root->fs_info;
 	int ret;
 	char *ptr;
 	struct extent_buffer *leaf;
@@ -35,7 +34,7 @@ static struct btrfs_dir_item *insert_with_overflow(struct btrfs_trans_handle
 	ret = btrfs_insert_empty_item(trans, root, path, cpu_key, data_size);
 	if (ret == -EEXIST) {
 		struct btrfs_dir_item *di;
-		di = btrfs_match_dir_item_name(fs_info, path, name, name_len);
+		di = btrfs_match_dir_item_name(path, name, name_len);
 		if (di)
 			return ERR_PTR(-EEXIST);
 		btrfs_extend_item(trans, path, data_size);
@@ -190,7 +189,7 @@ static struct btrfs_dir_item *btrfs_lookup_match_dir(
 	if (ret > 0)
 		return ERR_PTR(-ENOENT);
 
-	return btrfs_match_dir_item_name(root->fs_info, path, name, name_len);
+	return btrfs_match_dir_item_name(path, name, name_len);
 }
 
 /*
@@ -341,8 +340,7 @@ btrfs_search_dir_index_item(struct btrfs_root *root, struct btrfs_path *path,
 		if (key.objectid != dirid || key.type != BTRFS_DIR_INDEX_KEY)
 			break;
 
-		di = btrfs_match_dir_item_name(root->fs_info, path,
-					       name->name, name->len);
+		di = btrfs_match_dir_item_name(path, name->name, name->len);
 		if (di)
 			return di;
 	}
@@ -378,8 +376,7 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
  * this walks through all the entries in a dir item and finds one
  * for a specific name.
  */
-struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_fs_info *fs_info,
-						 const struct btrfs_path *path,
+struct btrfs_dir_item *btrfs_match_dir_item_name(const struct btrfs_path *path,
 						 const char *name, int name_len)
 {
 	struct btrfs_dir_item *dir_item;
diff --git a/fs/btrfs/dir-item.h b/fs/btrfs/dir-item.h
index 5f6dfafc91f1..28d69970bc70 100644
--- a/fs/btrfs/dir-item.h
+++ b/fs/btrfs/dir-item.h
@@ -44,8 +44,7 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
 					  struct btrfs_path *path, u64 dir,
 					  const char *name, u16 name_len,
 					  int mod);
-struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_fs_info *fs_info,
-						 const struct btrfs_path *path,
+struct btrfs_dir_item *btrfs_match_dir_item_name(const struct btrfs_path *path,
 						 const char *name,
 						 int name_len);
 
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 75bcfbda8d47..e3a0293a86b1 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -3760,7 +3760,6 @@ static int wait_for_dest_dir_move(struct send_ctx *sctx,
 				  struct recorded_ref *parent_ref,
 				  const bool is_orphan)
 {
-	struct btrfs_fs_info *fs_info = sctx->parent_root->fs_info;
 	struct btrfs_path *path;
 	struct btrfs_key key;
 	struct btrfs_key di_key;
@@ -3789,7 +3788,7 @@ static int wait_for_dest_dir_move(struct send_ctx *sctx,
 		goto out;
 	}
 
-	di = btrfs_match_dir_item_name(fs_info, path, parent_ref->name,
+	di = btrfs_match_dir_item_name(path, parent_ref->name,
 				       parent_ref->name_len);
 	if (!di) {
 		ret = 0;
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index ce464cd8e0ac..bc18710d1dcf 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -85,7 +85,6 @@ int btrfs_setxattr(struct btrfs_trans_handle *trans, struct inode *inode,
 {
 	struct btrfs_dir_item *di = NULL;
 	struct btrfs_root *root = BTRFS_I(inode)->root;
-	struct btrfs_fs_info *fs_info = root->fs_info;
 	struct btrfs_path *path;
 	size_t name_len = strlen(name);
 	int ret = 0;
@@ -143,14 +142,14 @@ int btrfs_setxattr(struct btrfs_trans_handle *trans, struct inode *inode,
 		 */
 		ret = 0;
 		btrfs_assert_tree_write_locked(path->nodes[0]);
-		di = btrfs_match_dir_item_name(fs_info, path, name, name_len);
+		di = btrfs_match_dir_item_name(path, name, name_len);
 		if (!di && !(flags & XATTR_REPLACE)) {
 			ret = -ENOSPC;
 			goto out;
 		}
 	} else if (ret == -EEXIST) {
 		ret = 0;
-		di = btrfs_match_dir_item_name(fs_info, path, name, name_len);
+		di = btrfs_match_dir_item_name(path, name, name_len);
 		ASSERT(di); /* logic error */
 	} else if (ret) {
 		goto out;
-- 
2.45.0


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

* [PATCH 25/25] btrfs: drop unused parameter level from alloc_heuristic_ws()
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (23 preceding siblings ...)
  2024-10-09 14:32 ` [PATCH 24/25] btrfs: drop unused parameter fs_info from btrfs_match_dir_item_name() David Sterba
@ 2024-10-09 14:32 ` David Sterba
  2024-10-11 11:45 ` [PATCH 00/25] Unused parameter cleanups Anand Jain
  25 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-09 14:32 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The compression heuristic pass does not need a level, so we can drop the
parameter.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/compression.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 655e3212b409..abcf8ed06afc 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -702,7 +702,7 @@ static void free_heuristic_ws(struct list_head *ws)
 	kfree(workspace);
 }
 
-static struct list_head *alloc_heuristic_ws(unsigned int level)
+static struct list_head *alloc_heuristic_ws(void)
 {
 	struct heuristic_ws *ws;
 
@@ -744,7 +744,7 @@ static const struct btrfs_compress_op * const btrfs_compress_op[] = {
 static struct list_head *alloc_workspace(int type, unsigned int level)
 {
 	switch (type) {
-	case BTRFS_COMPRESS_NONE: return alloc_heuristic_ws(level);
+	case BTRFS_COMPRESS_NONE: return alloc_heuristic_ws();
 	case BTRFS_COMPRESS_ZLIB: return zlib_alloc_workspace(level);
 	case BTRFS_COMPRESS_LZO:  return lzo_alloc_workspace();
 	case BTRFS_COMPRESS_ZSTD: return zstd_alloc_workspace(level);
-- 
2.45.0


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

* Re: [PATCH 00/25] Unused parameter cleanups
  2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
                   ` (24 preceding siblings ...)
  2024-10-09 14:32 ` [PATCH 25/25] btrfs: drop unused parameter level from alloc_heuristic_ws() David Sterba
@ 2024-10-11 11:45 ` Anand Jain
  2024-10-11 15:54   ` David Sterba
  25 siblings, 1 reply; 28+ messages in thread
From: Anand Jain @ 2024-10-11 11:45 UTC (permalink / raw)
  To: David Sterba, linux-btrfs

On 9/10/24 8:00 pm, David Sterba wrote:
> Assorted unused parameter removal, I tried to go to history where it was
> last used and seemed important. Most of them look like leftovers after
> other changes.
> 

I'm curious, how did you come across them?
Using `CFLAGS="-Wunused-parameter"` or `-C=1` doesn't seem to report them.

LGTM for the entire series.

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

Thx.



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

* Re: [PATCH 00/25] Unused parameter cleanups
  2024-10-11 11:45 ` [PATCH 00/25] Unused parameter cleanups Anand Jain
@ 2024-10-11 15:54   ` David Sterba
  0 siblings, 0 replies; 28+ messages in thread
From: David Sterba @ 2024-10-11 15:54 UTC (permalink / raw)
  To: Anand Jain; +Cc: David Sterba, linux-btrfs

On Fri, Oct 11, 2024 at 07:45:52PM +0800, Anand Jain wrote:
> On 9/10/24 8:00 pm, David Sterba wrote:
> > Assorted unused parameter removal, I tried to go to history where it was
> > last used and seemed important. Most of them look like leftovers after
> > other changes.
> > 
> 
> I'm curious, how did you come across them?
> Using `CFLAGS="-Wunused-parameter"` or `-C=1` doesn't seem to report them.

Passing custom flags works

  $ make ccflags-y=-Wunused-parameter fs/btrfs/

There are many out of btrfs code warnings so the rest was manual search
for 'fs.btrfs.*warning.*unused' and code inspection.

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

end of thread, other threads:[~2024-10-11 15:54 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 14:30 [PATCH 00/25] Unused parameter cleanups David Sterba
2024-10-09 14:30 ` [PATCH 01/25] btrfs: zstd: assert the timer pointer in callback David Sterba
2024-10-09 14:30 ` [PATCH 02/25] btrfs: drop unused parameter path from btrfs_tree_mod_log_rewind() David Sterba
2024-10-09 14:30 ` [PATCH 03/25] btrfs: drop unused parameter ctx from batch_delete_dir_index_items() David Sterba
2024-10-09 14:31 ` [PATCH 04/25] btrfs: drop unused parameter fs_info from wait_reserve_ticket() David Sterba
2024-10-09 14:31 ` [PATCH 05/25] btrfs: drop unused parameter fs_info from do_reclaim_sweep() David Sterba
2024-10-09 14:31 ` [PATCH 06/25] btrfs: send: drop unused parameter num from iterate_inode_ref_t callbacks David Sterba
2024-10-09 14:31 ` [PATCH 07/25] btrfs: send: drop unused parameter index " David Sterba
2024-10-09 14:31 ` [PATCH 08/25] btrfs: scrub: drop unused parameter sctx from scrub_submit_extent_sector_read() David Sterba
2024-10-09 14:31 ` [PATCH 09/25] btrfs: drop unused parameter map from scrub_simple_mirror() David Sterba
2024-10-09 14:31 ` [PATCH 10/25] btrfs: qgroup: drop unused parameter fs_info from __del_qgroup_rb() David Sterba
2024-10-09 14:31 ` [PATCH 11/25] btrfs: drop unused transaction parameter from btrfs_qgroup_add_swapped_blocks() David Sterba
2024-10-09 14:31 ` [PATCH 12/25] btrfs: lzo: drop unused paramter level from lzo_alloc_workspace() David Sterba
2024-10-09 14:31 ` [PATCH 13/25] btrfs: drop unused parameter argp from btrfs_ioctl_quota_rescan_wait() David Sterba
2024-10-09 14:31 ` [PATCH 14/25] btrfs: drop unused parameter inode from read_inline_extent() David Sterba
2024-10-09 14:31 ` [PATCH 15/25] btrfs: drop unused parameter offset from __cow_file_range_inline() David Sterba
2024-10-09 14:31 ` [PATCH 16/25] btrfs: drop unused parameter file_offset from btrfs_encoded_read_regular_fill_pages() David Sterba
2024-10-09 14:31 ` [PATCH 17/25] btrfs: drop unused parameter iov_iter from btrfs_write_check() David Sterba
2024-10-09 14:31 ` [PATCH 18/25] btrfs: drop unused parameter refs from visit_node_for_delete() David Sterba
2024-10-09 14:31 ` [PATCH 19/25] btrfs: drop unused parameter mask from try_release_extent_state() David Sterba
2024-10-09 14:32 ` [PATCH 20/25] btrfs: drop unused parameter fs_info from folio_range_has_eb() David Sterba
2024-10-09 14:32 ` [PATCH 21/25] btrfs: drop unused parameter options from open_ctree() David Sterba
2024-10-09 14:32 ` [PATCH 22/25] btrfs: drop unused parameter data from btrfs_fill_super() David Sterba
2024-10-09 14:32 ` [PATCH 23/25] btrfs: drop unused parameter transaction from alloc_log_tree() David Sterba
2024-10-09 14:32 ` [PATCH 24/25] btrfs: drop unused parameter fs_info from btrfs_match_dir_item_name() David Sterba
2024-10-09 14:32 ` [PATCH 25/25] btrfs: drop unused parameter level from alloc_heuristic_ws() David Sterba
2024-10-11 11:45 ` [PATCH 00/25] Unused parameter cleanups Anand Jain
2024-10-11 15:54   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).