Commit d9c75027 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: convert run_delalloc_compressed() to take a folio

This just passes the page into the compressed machinery to keep track of
the locked page.  Update this to take a folio and convert it to a page
where appropriate.
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 94cea66d
......@@ -1653,7 +1653,7 @@ static noinline void submit_compressed_extents(struct btrfs_work *work, bool do_
}
static bool run_delalloc_compressed(struct btrfs_inode *inode,
struct page *locked_page, u64 start,
struct folio *locked_folio, u64 start,
u64 end, struct writeback_control *wbc)
{
struct btrfs_fs_info *fs_info = inode->root->fs_info;
......@@ -1693,15 +1693,16 @@ static bool run_delalloc_compressed(struct btrfs_inode *inode,
INIT_LIST_HEAD(&async_chunk[i].extents);
/*
* The locked_page comes all the way from writepage and its
* the original page we were actually given. As we spread
* The locked_folio comes all the way from writepage and its
* the original folio we were actually given. As we spread
* this large delalloc region across multiple async_chunk
* structs, only the first struct needs a pointer to locked_page
* structs, only the first struct needs a pointer to
* locked_folio.
*
* This way we don't need racey decisions about who is supposed
* to unlock it.
*/
if (locked_page) {
if (locked_folio) {
/*
* Depending on the compressibility, the pages might or
* might not go through async. We want all of them to
......@@ -1711,10 +1712,10 @@ static bool run_delalloc_compressed(struct btrfs_inode *inode,
* need full accuracy. Just account the whole thing
* against the first page.
*/
wbc_account_cgroup_owner(wbc, locked_page,
wbc_account_cgroup_owner(wbc, &locked_folio->page,
cur_end - start);
async_chunk[i].locked_page = locked_page;
locked_page = NULL;
async_chunk[i].locked_page = &locked_folio->page;
locked_folio = NULL;
} else {
async_chunk[i].locked_page = NULL;
}
......@@ -2307,7 +2308,8 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page
if (btrfs_inode_can_compress(inode) &&
inode_need_compress(inode, start, end) &&
run_delalloc_compressed(inode, locked_page, start, end, wbc))
run_delalloc_compressed(inode, page_folio(locked_page), start, end,
wbc))
return 1;
if (zoned)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment