]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: convert try_release_extent_mapping() to take a folio
authorLi Zetao <lizetao1@huawei.com>
Wed, 28 Aug 2024 18:29:03 +0000 (02:29 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 10 Sep 2024 14:51:21 +0000 (16:51 +0200)
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>
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/inode.c

index 430dc1b9de320e013079baaf8a3f62e7e75fedfe..c07930986fe586da37d90b04e14dc2abdeb3c749 100644 (file)
@@ -2341,11 +2341,11 @@ static bool try_release_extent_state(struct extent_io_tree *tree,
  * in the range corresponding to the page, both state records and extent
  * map records are removed
  */
-bool try_release_extent_mapping(struct page *page, gfp_t mask)
+bool try_release_extent_mapping(struct folio *folio, gfp_t mask)
 {
-       u64 start = page_offset(page);
+       u64 start = folio_pos(folio);
        u64 end = start + PAGE_SIZE - 1;
-       struct btrfs_inode *inode = page_to_inode(page);
+       struct btrfs_inode *inode = folio_to_inode(folio);
        struct extent_io_tree *io_tree = &inode->io_tree;
 
        while (start <= end) {
index 345774c84c4bcade791ad5fa9122384c62036868..8a36117ed4532bb502db2dc8919b401b96cd7c95 100644 (file)
@@ -236,7 +236,7 @@ static inline void extent_changeset_free(struct extent_changeset *changeset)
        kfree(changeset);
 }
 
-bool try_release_extent_mapping(struct page *page, gfp_t mask);
+bool try_release_extent_mapping(struct folio *folio, gfp_t mask);
 int try_release_extent_buffer(struct folio *folio);
 
 int btrfs_read_folio(struct file *file, struct folio *folio);
index 5e3c772eed2b432b061ad3b4926da7184aa67a71..1483e33127b7729789ea77438bfc7b52f2cd783d 100644 (file)
@@ -7238,7 +7238,7 @@ static int btrfs_launder_folio(struct folio *folio)
 
 static bool __btrfs_release_folio(struct folio *folio, gfp_t gfp_flags)
 {
-       if (try_release_extent_mapping(&folio->page, gfp_flags)) {
+       if (try_release_extent_mapping(folio, gfp_flags)) {
                wait_subpage_spinlock(folio);
                clear_folio_extent_mapped(folio);
                return true;