Skip to content

Commit

Permalink
btrfs: convert btrfs_set_range_writeback() to use a folio
Browse files Browse the repository at this point in the history
We already use a lot of functions here that use folios, update the
function to use __filemap_get_folio instead of find_get_page and then
use the folio directly.

Signed-off-by: Josef Bacik <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
josefbacik authored and kdave committed Sep 10, 2024
1 parent dfc9e30 commit 1bbf3a3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -8958,19 +8958,19 @@ void btrfs_set_range_writeback(struct btrfs_inode *inode, u64 start, u64 end)
struct btrfs_fs_info *fs_info = inode->root->fs_info;
unsigned long index = start >> PAGE_SHIFT;
unsigned long end_index = end >> PAGE_SHIFT;
struct page *page;
struct folio *folio;
u32 len;

ASSERT(end + 1 - start <= U32_MAX);
len = end + 1 - start;
while (index <= end_index) {
page = find_get_page(inode->vfs_inode.i_mapping, index);
ASSERT(page); /* Pages should be in the extent_io_tree */
folio = __filemap_get_folio(inode->vfs_inode.i_mapping, index, 0, 0);
ASSERT(!IS_ERR(folio)); /* folios should be in the extent_io_tree */

/* This is for data, which doesn't yet support larger folio. */
ASSERT(folio_order(page_folio(page)) == 0);
btrfs_folio_set_writeback(fs_info, page_folio(page), start, len);
put_page(page);
ASSERT(folio_order(folio) == 0);
btrfs_folio_set_writeback(fs_info, folio, start, len);
folio_put(folio);
index++;
}
}
Expand Down

0 comments on commit 1bbf3a3

Please sign in to comment.