Skip to content

Commit 046c0d6

Browse files
Li Zetaokdave
authored andcommitted
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 <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent dd0a8df commit 046c0d6

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

fs/btrfs/extent_io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2341,11 +2341,11 @@ static bool try_release_extent_state(struct extent_io_tree *tree,
23412341
* in the range corresponding to the page, both state records and extent
23422342
* map records are removed
23432343
*/
2344-
bool try_release_extent_mapping(struct page *page, gfp_t mask)
2344+
bool try_release_extent_mapping(struct folio *folio, gfp_t mask)
23452345
{
2346-
u64 start = page_offset(page);
2346+
u64 start = folio_pos(folio);
23472347
u64 end = start + PAGE_SIZE - 1;
2348-
struct btrfs_inode *inode = page_to_inode(page);
2348+
struct btrfs_inode *inode = folio_to_inode(folio);
23492349
struct extent_io_tree *io_tree = &inode->io_tree;
23502350

23512351
while (start <= end) {

fs/btrfs/extent_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ static inline void extent_changeset_free(struct extent_changeset *changeset)
236236
kfree(changeset);
237237
}
238238

239-
bool try_release_extent_mapping(struct page *page, gfp_t mask);
239+
bool try_release_extent_mapping(struct folio *folio, gfp_t mask);
240240
int try_release_extent_buffer(struct folio *folio);
241241

242242
int btrfs_read_folio(struct file *file, struct folio *folio);

fs/btrfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7238,7 +7238,7 @@ static int btrfs_launder_folio(struct folio *folio)
72387238

72397239
static bool __btrfs_release_folio(struct folio *folio, gfp_t gfp_flags)
72407240
{
7241-
if (try_release_extent_mapping(&folio->page, gfp_flags)) {
7241+
if (try_release_extent_mapping(folio, gfp_flags)) {
72427242
wait_subpage_spinlock(folio);
72437243
clear_folio_extent_mapped(folio);
72447244
return true;

0 commit comments

Comments
 (0)