Skip to content

Commit 266a936

Browse files
Li Zetaokdave
authored andcommitted
btrfs: convert clear_page_extent_mapped() to take a folio
The old page API is being gradually replaced and converted to use folio to improve code readability and avoid repeated conversion between page and folio. Now clear_page_extent_mapped() can deal with a folio directly, so change its name to clear_folio_extent_mapped(). Signed-off-by: Li Zetao <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent fd1e75d commit 266a936

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

fs/btrfs/extent_io.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -877,18 +877,17 @@ int set_folio_extent_mapped(struct folio *folio)
877877
return 0;
878878
}
879879

880-
void clear_page_extent_mapped(struct page *page)
880+
void clear_folio_extent_mapped(struct folio *folio)
881881
{
882-
struct folio *folio = page_folio(page);
883882
struct btrfs_fs_info *fs_info;
884883

885-
ASSERT(page->mapping);
884+
ASSERT(folio->mapping);
886885

887886
if (!folio_test_private(folio))
888887
return;
889888

890-
fs_info = page_to_fs_info(page);
891-
if (btrfs_is_subpage(fs_info, page->mapping))
889+
fs_info = folio_to_fs_info(folio);
890+
if (btrfs_is_subpage(fs_info, folio->mapping))
892891
return btrfs_detach_subpage(fs_info, folio);
893892

894893
folio_detach_private(folio);

fs/btrfs/extent_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ int btree_write_cache_pages(struct address_space *mapping,
249249
void btrfs_readahead(struct readahead_control *rac);
250250
int set_folio_extent_mapped(struct folio *folio);
251251
int set_page_extent_mapped(struct page *page);
252-
void clear_page_extent_mapped(struct page *page);
252+
void clear_folio_extent_mapped(struct folio *folio);
253253

254254
struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,
255255
u64 start, u64 owner_root, int level);

fs/btrfs/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7240,7 +7240,7 @@ static bool __btrfs_release_folio(struct folio *folio, gfp_t gfp_flags)
72407240
{
72417241
if (try_release_extent_mapping(&folio->page, gfp_flags)) {
72427242
wait_subpage_spinlock(folio);
7243-
clear_page_extent_mapped(&folio->page);
7243+
clear_folio_extent_mapped(folio);
72447244
return true;
72457245
}
72467246
return false;
@@ -7438,7 +7438,7 @@ static void btrfs_invalidate_folio(struct folio *folio, size_t offset,
74387438
btrfs_folio_clear_checked(fs_info, folio, folio_pos(folio), folio_size(folio));
74397439
if (!inode_evicting)
74407440
__btrfs_release_folio(folio, GFP_NOFS);
7441-
clear_page_extent_mapped(&folio->page);
7441+
clear_folio_extent_mapped(folio);
74427442
}
74437443

74447444
static int btrfs_truncate(struct btrfs_inode *inode, bool skip_writeback)

0 commit comments

Comments
 (0)