mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 14:44:10 +08:00
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>
This commit is contained in:
parent
8fd2b12e6a
commit
dfba9f4773
@ -930,17 +930,21 @@ static int attach_extent_buffer_folio(struct extent_buffer *eb,
|
|||||||
|
|
||||||
int set_page_extent_mapped(struct page *page)
|
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;
|
struct btrfs_fs_info *fs_info;
|
||||||
|
|
||||||
ASSERT(page->mapping);
|
ASSERT(folio->mapping);
|
||||||
|
|
||||||
if (folio_test_private(folio))
|
if (folio_test_private(folio))
|
||||||
return 0;
|
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);
|
return btrfs_attach_subpage(fs_info, folio, BTRFS_SUBPAGE_DATA);
|
||||||
|
|
||||||
folio_attach_private(folio, (void *)EXTENT_FOLIO_PRIVATE);
|
folio_attach_private(folio, (void *)EXTENT_FOLIO_PRIVATE);
|
||||||
|
@ -229,6 +229,7 @@ int btree_write_cache_pages(struct address_space *mapping,
|
|||||||
void extent_readahead(struct readahead_control *rac);
|
void extent_readahead(struct readahead_control *rac);
|
||||||
int extent_fiemap(struct btrfs_inode *inode, struct fiemap_extent_info *fieinfo,
|
int extent_fiemap(struct btrfs_inode *inode, struct fiemap_extent_info *fieinfo,
|
||||||
u64 start, u64 len);
|
u64 start, u64 len);
|
||||||
|
int set_folio_extent_mapped(struct folio *folio);
|
||||||
int set_page_extent_mapped(struct page *page);
|
int set_page_extent_mapped(struct page *page);
|
||||||
void clear_page_extent_mapped(struct page *page);
|
void clear_page_extent_mapped(struct page *page);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user