Skip to content

Commit a43caf8

Browse files
committed
btrfs: switch grab_extent_buffer() to folios
Use the folio API, remove page_folio/folio_page conversions. Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Anand Jain <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent cc8f51a commit a43caf8

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

fs/btrfs/extent_io.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2812,13 +2812,12 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,
28122812
}
28132813
#endif
28142814

2815-
static struct extent_buffer *grab_extent_buffer(
2816-
struct btrfs_fs_info *fs_info, struct page *page)
2815+
static struct extent_buffer *grab_extent_buffer(struct btrfs_fs_info *fs_info,
2816+
struct folio *folio)
28172817
{
2818-
struct folio *folio = page_folio(page);
28192818
struct extent_buffer *exists;
28202819

2821-
lockdep_assert_held(&page->mapping->i_private_lock);
2820+
lockdep_assert_held(&folio->mapping->i_private_lock);
28222821

28232822
/*
28242823
* For subpage case, we completely rely on radix tree to ensure we
@@ -2833,7 +2832,7 @@ static struct extent_buffer *grab_extent_buffer(
28332832
return NULL;
28342833

28352834
/*
2836-
* We could have already allocated an eb for this page and attached one
2835+
* We could have already allocated an eb for this folio and attached one
28372836
* so lets see if we can get a ref on the existing eb, and if we can we
28382837
* know it's good and we can just return that one, else we know we can
28392838
* just overwrite folio private.
@@ -2842,7 +2841,7 @@ static struct extent_buffer *grab_extent_buffer(
28422841
if (atomic_inc_not_zero(&exists->refs))
28432842
return exists;
28442843

2845-
WARN_ON(PageDirty(page));
2844+
WARN_ON(folio_test_dirty(folio));
28462845
folio_detach_private(folio);
28472846
return NULL;
28482847
}
@@ -2933,8 +2932,7 @@ static int attach_eb_folio_to_filemap(struct extent_buffer *eb, int i,
29332932
} else if (existing_folio) {
29342933
struct extent_buffer *existing_eb;
29352934

2936-
existing_eb = grab_extent_buffer(fs_info,
2937-
folio_page(existing_folio, 0));
2935+
existing_eb = grab_extent_buffer(fs_info, existing_folio);
29382936
if (existing_eb) {
29392937
/* The extent buffer still exists, we can use it directly. */
29402938
*found_eb_ret = existing_eb;

0 commit comments

Comments
 (0)