diff mbox series

[12/18] btrfs: switch grab_extent_buffer() to folios

Message ID cfc1126823c5690264d55a5186bd60381498bd8b.1736418116.git.dsterba@suse.com (mailing list archive)
State New
Headers show
Series Random cleanups for 6.14 | expand

Commit Message

David Sterba Jan. 9, 2025, 10:24 a.m. UTC
Use the folio API, remove page_folio/folio_page conversions.

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

Comments

Johannes Thumshirn Jan. 9, 2025, 12:40 p.m. UTC | #1
On 09.01.25 11:27, David Sterba wrote:
> -static struct extent_buffer *grab_extent_buffer(
> -		struct btrfs_fs_info *fs_info, struct page *page)
> +static struct extent_buffer *grab_extent_buffer(struct btrfs_fs_info *fs_info, struct folio *folio)

I'd personally break the line after fs_info so it fits nicely into 80 
chars. The 99 we have after folio seems excessive to me.
diff mbox series

Patch

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 2815972f69ec..ad1e54ab665e 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2811,13 +2811,11 @@  struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,
 }
 #endif
 
-static struct extent_buffer *grab_extent_buffer(
-		struct btrfs_fs_info *fs_info, struct page *page)
+static struct extent_buffer *grab_extent_buffer(struct btrfs_fs_info *fs_info, struct folio *folio)
 {
-	struct folio *folio = page_folio(page);
 	struct extent_buffer *exists;
 
-	lockdep_assert_held(&page->mapping->i_private_lock);
+	lockdep_assert_held(&folio->mapping->i_private_lock);
 
 	/*
 	 * For subpage case, we completely rely on radix tree to ensure we
@@ -2832,7 +2830,7 @@  static struct extent_buffer *grab_extent_buffer(
 		return NULL;
 
 	/*
-	 * We could have already allocated an eb for this page and attached one
+	 * We could have already allocated an eb for this folio and attached one
 	 * so lets see if we can get a ref on the existing eb, and if we can we
 	 * know it's good and we can just return that one, else we know we can
 	 * just overwrite folio private.
@@ -2841,7 +2839,7 @@  static struct extent_buffer *grab_extent_buffer(
 	if (atomic_inc_not_zero(&exists->refs))
 		return exists;
 
-	WARN_ON(PageDirty(page));
+	WARN_ON(folio_test_dirty(folio));
 	folio_detach_private(folio);
 	return NULL;
 }
@@ -2932,8 +2930,7 @@  static int attach_eb_folio_to_filemap(struct extent_buffer *eb, int i,
 	} else if (existing_folio) {
 		struct extent_buffer *existing_eb;
 
-		existing_eb = grab_extent_buffer(fs_info,
-						 folio_page(existing_folio, 0));
+		existing_eb = grab_extent_buffer(fs_info, existing_folio);
 		if (existing_eb) {
 			/* The extent buffer still exists, we can use it directly. */
 			*found_eb_ret = existing_eb;