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

btrfs: convert extent_clear_unlock_delalloc() to take a folio

Instead of taking the locked page, take the locked folio so we can pass
that into __process_folios_contig.
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 c9ce51d6
...@@ -394,14 +394,14 @@ noinline_for_stack bool find_lock_delalloc_range(struct inode *inode, ...@@ -394,14 +394,14 @@ noinline_for_stack bool find_lock_delalloc_range(struct inode *inode,
} }
void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end, void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
const struct page *locked_page, const struct folio *locked_folio,
struct extent_state **cached, struct extent_state **cached,
u32 clear_bits, unsigned long page_ops) u32 clear_bits, unsigned long page_ops)
{ {
clear_extent_bit(&inode->io_tree, start, end, clear_bits, cached); clear_extent_bit(&inode->io_tree, start, end, clear_bits, cached);
__process_folios_contig(inode->vfs_inode.i_mapping, __process_folios_contig(inode->vfs_inode.i_mapping, locked_folio, start,
page_folio(locked_page), start, end, page_ops); end, page_ops);
} }
static bool btrfs_verify_folio(struct folio *folio, u64 start, u32 len) static bool btrfs_verify_folio(struct folio *folio, u64 start, u32 len)
......
...@@ -354,7 +354,7 @@ void set_extent_buffer_dirty(struct extent_buffer *eb); ...@@ -354,7 +354,7 @@ void set_extent_buffer_dirty(struct extent_buffer *eb);
void set_extent_buffer_uptodate(struct extent_buffer *eb); void set_extent_buffer_uptodate(struct extent_buffer *eb);
void clear_extent_buffer_uptodate(struct extent_buffer *eb); void clear_extent_buffer_uptodate(struct extent_buffer *eb);
void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end, void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
const struct page *locked_page, const struct folio *locked_folio,
struct extent_state **cached, struct extent_state **cached,
u32 bits_to_clear, unsigned long page_ops); u32 bits_to_clear, unsigned long page_ops);
int extent_invalidate_folio(struct extent_io_tree *tree, int extent_invalidate_folio(struct extent_io_tree *tree,
......
...@@ -743,10 +743,10 @@ static noinline int cow_file_range_inline(struct btrfs_inode *inode, ...@@ -743,10 +743,10 @@ static noinline int cow_file_range_inline(struct btrfs_inode *inode,
if (ret == 0) if (ret == 0)
locked_page = NULL; locked_page = NULL;
extent_clear_unlock_delalloc(inode, offset, end, locked_page, &cached, extent_clear_unlock_delalloc(inode, offset, end,
clear_flags, page_folio(locked_page), &cached,
PAGE_UNLOCK | PAGE_START_WRITEBACK | clear_flags, PAGE_UNLOCK |
PAGE_END_WRITEBACK); PAGE_START_WRITEBACK | PAGE_END_WRITEBACK);
return ret; return ret;
} }
...@@ -1501,7 +1501,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode, ...@@ -1501,7 +1501,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
page_ops |= PAGE_SET_ORDERED; page_ops |= PAGE_SET_ORDERED;
extent_clear_unlock_delalloc(inode, start, start + ram_size - 1, extent_clear_unlock_delalloc(inode, start, start + ram_size - 1,
locked_page, &cached, page_folio(locked_page), &cached,
EXTENT_LOCKED | EXTENT_DELALLOC, EXTENT_LOCKED | EXTENT_DELALLOC,
page_ops); page_ops);
if (num_bytes < cur_alloc_size) if (num_bytes < cur_alloc_size)
...@@ -1560,7 +1560,8 @@ static noinline int cow_file_range(struct btrfs_inode *inode, ...@@ -1560,7 +1560,8 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
if (!locked_page) if (!locked_page)
mapping_set_error(inode->vfs_inode.i_mapping, ret); mapping_set_error(inode->vfs_inode.i_mapping, ret);
extent_clear_unlock_delalloc(inode, orig_start, start - 1, extent_clear_unlock_delalloc(inode, orig_start, start - 1,
locked_page, NULL, 0, page_ops); page_folio(locked_page), NULL, 0,
page_ops);
} }
/* /*
...@@ -1583,7 +1584,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode, ...@@ -1583,7 +1584,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
if (extent_reserved) { if (extent_reserved) {
extent_clear_unlock_delalloc(inode, start, extent_clear_unlock_delalloc(inode, start,
start + cur_alloc_size - 1, start + cur_alloc_size - 1,
locked_page, &cached, page_folio(locked_page), &cached,
clear_bits, clear_bits,
page_ops); page_ops);
btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL); btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL);
...@@ -1598,8 +1599,9 @@ static noinline int cow_file_range(struct btrfs_inode *inode, ...@@ -1598,8 +1599,9 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
*/ */
if (start < end) { if (start < end) {
clear_bits |= EXTENT_CLEAR_DATA_RESV; clear_bits |= EXTENT_CLEAR_DATA_RESV;
extent_clear_unlock_delalloc(inode, start, end, locked_page, extent_clear_unlock_delalloc(inode, start, end,
&cached, clear_bits, page_ops); page_folio(locked_page), &cached,
clear_bits, page_ops);
btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL); btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL);
} }
return ret; return ret;
...@@ -2207,7 +2209,8 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode, ...@@ -2207,7 +2209,8 @@ 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,
locked_page, &cached_state, page_folio(locked_page),
&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);
...@@ -2256,7 +2259,7 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode, ...@@ -2256,7 +2259,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,
locked_page, &cached, page_folio(locked_page), &cached,
EXTENT_LOCKED | EXTENT_DELALLOC | EXTENT_LOCKED | EXTENT_DELALLOC |
EXTENT_DEFRAG | EXTENT_DEFRAG |
EXTENT_DO_ACCOUNTING, PAGE_UNLOCK | EXTENT_DO_ACCOUNTING, PAGE_UNLOCK |
......
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