Skip to contentSkip to conversation

btrfs: remove a couple pointless callback wrappers

PATCH In review [email protected] 5 participants 9 messages Mar 18, 2024 Btrfs file system

lore
Share & tools
lore
#0 lore raw

cover btrfs: remove a couple pointless callback wrappers

From: Filipe Manana <[email protected]>

Trivial stuff, details in the change logs.

Filipe Manana (2):
btrfs: remove pointless readahead callback wrapper
btrfs: remove pointless writepages callback wrapper

 fs/btrfs/extent_io.c |  5 ++---
 fs/btrfs/extent_io.h |  5 ++---
 fs/btrfs/inode.c     | 11 -----------
 3 files changed, 4 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 btrfs: remove pointless readahead callback wrapper

From: Filipe Manana <[email protected]>

There's no point in having a static readahead callback in inode.c that does nothing besides calling extent_readahead() from extent_io.c. So just remove the callback at inode.c and rename extent_readahead() to btrfs_readahead().

---
 fs/btrfs/extent_io.c | 2 +-
 fs/btrfs/extent_io.h | 2 +-
 fs/btrfs/inode.c     | 5 -----
 3 files changed, 2 insertions(+), 7 deletions(-)
fs/btrfs/extent_io.c +1 -1
index 7441245b1ceb..47a299b0fa2d 100644
@@ -2277,7 +2277,7 @@ int extent_writepages(struct address_space *mapping,
 	return ret;
 }
 
-void extent_readahead(struct readahead_control *rac)
+void btrfs_readahead(struct readahead_control *rac)
 {
 	struct btrfs_bio_ctrl bio_ctrl = { .opf = REQ_OP_READ | REQ_RAHEAD };
 	struct page *pagepool[16];
fs/btrfs/extent_io.h +1 -1
index e3530d427e1f..eb123b0499e1 100644
@@ -241,7 +241,7 @@ int extent_writepages(struct address_space *mapping,
 		      struct writeback_control *wbc);
 int btree_write_cache_pages(struct address_space *mapping,
 			    struct writeback_control *wbc);
-void extent_readahead(struct readahead_control *rac);
+void btrfs_readahead(struct readahead_control *rac);
 int extent_fiemap(struct btrfs_inode *inode, struct fiemap_extent_info *fieinfo,
 		  u64 start, u64 len);
 int set_folio_extent_mapped(struct folio *folio);
fs/btrfs/inode.c +0 -5
index 37701531eeb1..e447a4f1d926 100644
@@ -7919,11 +7919,6 @@ static int btrfs_writepages(struct address_space *mapping,
 	return extent_writepages(mapping, wbc);
 }
 
-static void btrfs_readahead(struct readahead_control *rac)
-{
-	extent_readahead(rac);
-}
-
 /*
  * For release_folio() and invalidate_folio() we have a race window where
  * folio_end_writeback() is called but the subpage spinlock is not yet released.
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/2 btrfs: remove pointless writepages callback wrapper

In reply to [email protected]

From: Filipe Manana <[email protected]>

There's no point in having a static writepages callback in inode.c that does nothing besides calling extent_writepages from extent_io.c. So just remove the callback at inode.c and rename extent_writepages() to btrfs_writepages().

---
 fs/btrfs/extent_io.c | 3 +--
 fs/btrfs/extent_io.h | 3 +--
 fs/btrfs/inode.c     | 6 ------
 3 files changed, 2 insertions(+), 10 deletions(-)
fs/btrfs/extent_io.c +1 -2
index 47a299b0fa2d..4a684251fd96 100644
@@ -2256,8 +2256,7 @@ void extent_write_locked_range(struct inode *inode, struct page *locked_page,
 	submit_write_bio(&bio_ctrl, found_error ? ret : 0);
 }
 
-int extent_writepages(struct address_space *mapping,
-		      struct writeback_control *wbc)
+int btrfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
 {
 	struct inode *inode = mapping->host;
 	int ret = 0;
fs/btrfs/extent_io.h +1 -2
index eb123b0499e1..818431b37124 100644
@@ -237,8 +237,7 @@ int btrfs_read_folio(struct file *file, struct folio *folio);
 void extent_write_locked_range(struct inode *inode, struct page *locked_page,
 			       u64 start, u64 end, struct writeback_control *wbc,
 			       bool pages_dirty);
-int extent_writepages(struct address_space *mapping,
-		      struct writeback_control *wbc);
+int btrfs_writepages(struct address_space *mapping, struct writeback_control *wbc);
 int btree_write_cache_pages(struct address_space *mapping,
 			    struct writeback_control *wbc);
 void btrfs_readahead(struct readahead_control *rac);
fs/btrfs/inode.c +0 -6
index e447a4f1d926..1fd2ea80caef 100644
@@ -7913,12 +7913,6 @@ static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 	return ret;
 }
 
-static int btrfs_writepages(struct address_space *mapping,
-			    struct writeback_control *wbc)
-{
-	return extent_writepages(mapping, wbc);
-}
-
 /*
  * For release_folio() and invalidate_folio() we have a race window where
  * folio_end_writeback() is called but the subpage spinlock is not yet released.
Signature · 1 line
2.43.0
Reviewed-by on the v1 series
#3 lore raw
In reply to [email protected]
Quoted 4 lines · On 18.03.24 13:15, [email protected] wrote:

From: Filipe Manana <[email protected]>

Trivial stuff, details in the change logs.

Quoted 9 lines

Filipe Manana (2):
btrfs: remove pointless readahead callback wrapper
btrfs: remove pointless writepages callback wrapper

  fs/btrfs/extent_io.c |  5 ++---
  fs/btrfs/extent_io.h |  5 ++---
  fs/btrfs/inode.c     | 11 -----------
  3 files changed, 4 insertions(+), 17 deletions(-)

Looks good,

Reviewed-by on the v1 series
#4 lore raw
In reply to [email protected]
Quoted 9 lines · On 3/18/24 17:44, [email protected] wrote:

From: Filipe Manana <[email protected]>

Trivial stuff, details in the change logs.

Filipe Manana (2):

btrfs: remove pointless readahead callback wrapper
btrfs: remove pointless writepages callback wrapper

Thanks.

Quoted 5 lines
  fs/btrfs/extent_io.c |  5 ++---
  fs/btrfs/extent_io.h |  5 ++---
  fs/btrfs/inode.c     | 11 -----------
  3 files changed, 4 insertions(+), 17 deletions(-)
Reviewed-by on the v1 series
#6 lore raw
In reply to [email protected]
Quoted 3 lines · 在 2024/3/18 22:44, [email protected] 写道:

From: Filipe Manana <[email protected]>

Trivial stuff, details in the change logs.

I guess it's just exposed by some random code reading?

No automatic tools to expose such single line wrapper?

Quoted 4 lines

Filipe Manana (2):
btrfs: remove pointless readahead callback wrapper
btrfs: remove pointless writepages callback wrapper

Anyway looks good to me.

Thanks,
Qu

Quoted 6 lines
  fs/btrfs/extent_io.c |  5 ++---
  fs/btrfs/extent_io.h |  5 ++---
  fs/btrfs/inode.c     | 11 -----------
  3 files changed, 4 insertions(+), 17 deletions(-)
#7 lore raw
Quoted 9 lines · Qu Wenruo
Quoted 3 lines · 在 2024/3/18 22:44, [email protected] 写道:

From: Filipe Manana <[email protected]>

Trivial stuff, details in the change logs.

I guess it's just exposed by some random code reading?

Yes, by reading.

Quoted 2 lines

No automatic tools to expose such single line wrapper?

Not that I know of. Maybe some coccinelle script could do it, dunno.

Quoted 18 lines
Quoted 5 lines

Filipe Manana (2):
btrfs: remove pointless readahead callback wrapper
btrfs: remove pointless writepages callback wrapper

Anyway looks good to me.

Thanks,
Qu

Quoted 6 lines
  fs/btrfs/extent_io.c |  5 ++---
  fs/btrfs/extent_io.h |  5 ++---
  fs/btrfs/inode.c     | 11 -----------
  3 files changed, 4 insertions(+), 17 deletions(-)
#8 lore raw
In reply to Qu Wenruo
Quoted 10 lines · Qu Wenruo
Quoted 3 lines · 在 2024/3/18 22:44, [email protected] 写道:

From: Filipe Manana <[email protected]>

Trivial stuff, details in the change logs.

I guess it's just exposed by some random code reading?

No automatic tools to expose such single line wrapper?

---
dentifier FUNC, CALL;
type TYPE;
@@

TYPE
FUNC(...)
{
* return CALL(...);
}
---

but not all trivial helpers should be removed, some of them have a semantic value or pair another fuction that is not trivial.