Commit 42a5947b authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: convert run_delalloc_nocow() to take a folio

Now all of the functions that use locked_page in run_delalloc_nocow take
a folio, update it to take a folio and update the caller.
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 39bbc56a
...@@ -1989,7 +1989,7 @@ static int can_nocow_file_extent(struct btrfs_path *path, ...@@ -1989,7 +1989,7 @@ static int can_nocow_file_extent(struct btrfs_path *path,
* blocks on disk * blocks on disk
*/ */
static noinline int run_delalloc_nocow(struct btrfs_inode *inode, static noinline int run_delalloc_nocow(struct btrfs_inode *inode,
struct page *locked_page, struct folio *locked_folio,
const u64 start, const u64 end) const u64 start, const u64 end)
{ {
struct btrfs_fs_info *fs_info = inode->root->fs_info; struct btrfs_fs_info *fs_info = inode->root->fs_info;
...@@ -2152,8 +2152,8 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode, ...@@ -2152,8 +2152,8 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode,
* NOCOW, following one which needs to be COW'ed * NOCOW, following one which needs to be COW'ed
*/ */
if (cow_start != (u64)-1) { if (cow_start != (u64)-1) {
ret = fallback_to_cow(inode, page_folio(locked_page), ret = fallback_to_cow(inode, locked_folio, cow_start,
cow_start, found_key.offset - 1); found_key.offset - 1);
cow_start = (u64)-1; cow_start = (u64)-1;
if (ret) { if (ret) {
btrfs_dec_nocow_writers(nocow_bg); btrfs_dec_nocow_writers(nocow_bg);
...@@ -2208,8 +2208,7 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode, ...@@ -2208,8 +2208,7 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode,
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
extent_clear_unlock_delalloc(inode, cur_offset, nocow_end, extent_clear_unlock_delalloc(inode, cur_offset, nocow_end,
page_folio(locked_page), locked_folio, &cached_state,
&cached_state,
EXTENT_LOCKED | EXTENT_DELALLOC | EXTENT_LOCKED | EXTENT_DELALLOC |
EXTENT_CLEAR_DATA_RESV, EXTENT_CLEAR_DATA_RESV,
PAGE_UNLOCK | PAGE_SET_ORDERED); PAGE_UNLOCK | PAGE_SET_ORDERED);
...@@ -2231,8 +2230,7 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode, ...@@ -2231,8 +2230,7 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode,
if (cow_start != (u64)-1) { if (cow_start != (u64)-1) {
cur_offset = end; cur_offset = end;
ret = fallback_to_cow(inode, page_folio(locked_page), cow_start, ret = fallback_to_cow(inode, locked_folio, cow_start, end);
end);
cow_start = (u64)-1; cow_start = (u64)-1;
if (ret) if (ret)
goto error; goto error;
...@@ -2259,7 +2257,7 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode, ...@@ -2259,7 +2257,7 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode,
lock_extent(&inode->io_tree, cur_offset, end, &cached); lock_extent(&inode->io_tree, cur_offset, end, &cached);
extent_clear_unlock_delalloc(inode, cur_offset, end, extent_clear_unlock_delalloc(inode, cur_offset, end,
page_folio(locked_page), &cached, locked_folio, &cached,
EXTENT_LOCKED | EXTENT_DELALLOC | EXTENT_LOCKED | EXTENT_DELALLOC |
EXTENT_DEFRAG | EXTENT_DEFRAG |
EXTENT_DO_ACCOUNTING, PAGE_UNLOCK | EXTENT_DO_ACCOUNTING, PAGE_UNLOCK |
...@@ -2300,7 +2298,8 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page ...@@ -2300,7 +2298,8 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page
start >= page_offset(locked_page) + PAGE_SIZE)); start >= page_offset(locked_page) + PAGE_SIZE));
if (should_nocow(inode, start, end)) { if (should_nocow(inode, start, end)) {
ret = run_delalloc_nocow(inode, locked_page, start, end); ret = run_delalloc_nocow(inode, page_folio(locked_page), start,
end);
goto out; goto out;
} }
......
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