diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2023-12-14 16:13:29 +0000 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2024-03-04 16:24:45 +0100 |
commit | dfba9f47730604a46c284f6099a11c5686b6289d (patch) | |
tree | 03bb6b3931b4e4a897462d827fff88b23b9a34e0 /fs/btrfs/extent_io.c | |
parent | 8fd2b12e6a414b383692c7f5ca05ab75204bdece (diff) | |
download | linux-stable-dfba9f47730604a46c284f6099a11c5686b6289d.tar.gz linux-stable-dfba9f47730604a46c284f6099a11c5686b6289d.tar.bz2 linux-stable-dfba9f47730604a46c284f6099a11c5686b6289d.zip |
btrfs: add set_folio_extent_mapped() helper
Turn set_page_extent_mapped() into a wrapper around this version.
Saves a call to compound_head() for callers who already have a folio
and removes a couple of users of page->mapping.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index b542bd1816df..cff67d03424d 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -930,17 +930,21 @@ static int attach_extent_buffer_folio(struct extent_buffer *eb, int set_page_extent_mapped(struct page *page) { - struct folio *folio = page_folio(page); + return set_folio_extent_mapped(page_folio(page)); +} + +int set_folio_extent_mapped(struct folio *folio) +{ struct btrfs_fs_info *fs_info; - ASSERT(page->mapping); + ASSERT(folio->mapping); if (folio_test_private(folio)) return 0; - fs_info = btrfs_sb(page->mapping->host->i_sb); + fs_info = btrfs_sb(folio->mapping->host->i_sb); - if (btrfs_is_subpage(fs_info, page->mapping)) + if (btrfs_is_subpage(fs_info, folio->mapping)) return btrfs_attach_subpage(fs_info, folio, BTRFS_SUBPAGE_DATA); folio_attach_private(folio, (void *)EXTENT_FOLIO_PRIVATE); |