Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

btrfs: convert try_release_extent_mapping() 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. And page_to_inode() can be replaced with folio_to_inode() now.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Li Zetao and committed by
David Sterba
046c0d65 dd0a8df4

+5 -5
+3 -3
fs/btrfs/extent_io.c
··· 2341 2341 * in the range corresponding to the page, both state records and extent 2342 2342 * map records are removed 2343 2343 */ 2344 - bool try_release_extent_mapping(struct page *page, gfp_t mask) 2344 + bool try_release_extent_mapping(struct folio *folio, gfp_t mask) 2345 2345 { 2346 - u64 start = page_offset(page); 2346 + u64 start = folio_pos(folio); 2347 2347 u64 end = start + PAGE_SIZE - 1; 2348 - struct btrfs_inode *inode = page_to_inode(page); 2348 + struct btrfs_inode *inode = folio_to_inode(folio); 2349 2349 struct extent_io_tree *io_tree = &inode->io_tree; 2350 2350 2351 2351 while (start <= end) {
+1 -1
fs/btrfs/extent_io.h
··· 236 236 kfree(changeset); 237 237 } 238 238 239 - bool try_release_extent_mapping(struct page *page, gfp_t mask); 239 + bool try_release_extent_mapping(struct folio *folio, gfp_t mask); 240 240 int try_release_extent_buffer(struct folio *folio); 241 241 242 242 int btrfs_read_folio(struct file *file, struct folio *folio);
+1 -1
fs/btrfs/inode.c
··· 7238 7238 7239 7239 static bool __btrfs_release_folio(struct folio *folio, gfp_t gfp_flags) 7240 7240 { 7241 - if (try_release_extent_mapping(&folio->page, gfp_flags)) { 7241 + if (try_release_extent_mapping(folio, gfp_flags)) { 7242 7242 wait_subpage_spinlock(folio); 7243 7243 clear_folio_extent_mapped(folio); 7244 7244 return true;