Commit ad7ff17b authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: make extent_clear_unlock_delalloc take btrfs_inode

It has one VFS and 1 btrfs inode usages but converting it to btrfs_inode
interface will allow seamless conversion of its callers.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 4b67c11d
......@@ -2018,15 +2018,14 @@ static int __process_pages_contig(struct address_space *mapping,
return err;
}
void extent_clear_unlock_delalloc(struct inode *inode, u64 start, u64 end,
void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
struct page *locked_page,
unsigned clear_bits,
unsigned long page_ops)
{
clear_extent_bit(&BTRFS_I(inode)->io_tree, start, end, clear_bits, 1, 0,
NULL);
clear_extent_bit(&inode->io_tree, start, end, clear_bits, 1, 0, NULL);
__process_pages_contig(inode->i_mapping, locked_page,
__process_pages_contig(inode->vfs_inode.i_mapping, locked_page,
start >> PAGE_SHIFT, end >> PAGE_SHIFT,
page_ops, NULL);
}
......
......@@ -277,7 +277,7 @@ void clear_extent_buffer_uptodate(struct extent_buffer *eb);
int extent_buffer_under_io(const struct extent_buffer *eb);
void extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end);
void extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end);
void extent_clear_unlock_delalloc(struct inode *inode, u64 start, u64 end,
void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
struct page *locked_page,
unsigned bits_to_clear,
unsigned long page_ops);
......
......@@ -642,7 +642,8 @@ static noinline int compress_file_range(struct async_chunk *async_chunk)
* our outstanding extent for clearing delalloc for this
* range.
*/
extent_clear_unlock_delalloc(inode, start, end, NULL,
extent_clear_unlock_delalloc(BTRFS_I(inode), start, end,
NULL,
clear_flags,
PAGE_UNLOCK |
PAGE_CLEAR_DIRTY |
......@@ -878,7 +879,7 @@ static noinline void submit_compressed_extents(struct async_chunk *async_chunk)
/*
* clear dirty, set writeback and unlock the pages.
*/
extent_clear_unlock_delalloc(inode, async_extent->start,
extent_clear_unlock_delalloc(BTRFS_I(inode), async_extent->start,
async_extent->start +
async_extent->ram_size - 1,
NULL, EXTENT_LOCKED | EXTENT_DELALLOC,
......@@ -900,7 +901,7 @@ static noinline void submit_compressed_extents(struct async_chunk *async_chunk)
btrfs_writepage_endio_finish_ordered(p, start, end, 0);
p->mapping = NULL;
extent_clear_unlock_delalloc(inode, start, end,
extent_clear_unlock_delalloc(BTRFS_I(inode), start, end,
NULL, 0,
PAGE_END_WRITEBACK |
PAGE_SET_ERROR);
......@@ -915,7 +916,7 @@ static noinline void submit_compressed_extents(struct async_chunk *async_chunk)
btrfs_dec_block_group_reservations(fs_info, ins.objectid);
btrfs_free_reserved_extent(fs_info, ins.objectid, ins.offset, 1);
out_free:
extent_clear_unlock_delalloc(inode, async_extent->start,
extent_clear_unlock_delalloc(BTRFS_I(inode), async_extent->start,
async_extent->start +
async_extent->ram_size - 1,
NULL, EXTENT_LOCKED | EXTENT_DELALLOC |
......@@ -1017,7 +1018,8 @@ static noinline int cow_file_range(struct inode *inode,
* our outstanding extent for clearing delalloc for this
* range.
*/
extent_clear_unlock_delalloc(inode, start, end, NULL,
extent_clear_unlock_delalloc(BTRFS_I(inode), start, end,
NULL,
EXTENT_LOCKED | EXTENT_DELALLOC |
EXTENT_DELALLOC_NEW | EXTENT_DEFRAG |
EXTENT_DO_ACCOUNTING, PAGE_UNLOCK |
......@@ -1115,7 +1117,7 @@ static noinline int cow_file_range(struct inode *inode,
page_ops = unlock ? PAGE_UNLOCK : 0;
page_ops |= PAGE_SET_PRIVATE2;
extent_clear_unlock_delalloc(inode, start,
extent_clear_unlock_delalloc(BTRFS_I(inode), start,
start + ram_size - 1,
locked_page,
EXTENT_LOCKED | EXTENT_DELALLOC,
......@@ -1160,7 +1162,7 @@ static noinline int cow_file_range(struct inode *inode,
* it the flag EXTENT_CLEAR_DATA_RESV.
*/
if (extent_reserved) {
extent_clear_unlock_delalloc(inode, start,
extent_clear_unlock_delalloc(BTRFS_I(inode), start,
start + cur_alloc_size - 1,
locked_page,
clear_bits,
......@@ -1169,7 +1171,7 @@ static noinline int cow_file_range(struct inode *inode,
if (start >= end)
goto out;
}
extent_clear_unlock_delalloc(inode, start, end, locked_page,
extent_clear_unlock_delalloc(BTRFS_I(inode), start, end, locked_page,
clear_bits | EXTENT_CLEAR_DATA_RESV,
page_ops);
goto out;
......@@ -1277,8 +1279,8 @@ static int cow_file_range_async(struct inode *inode,
PAGE_SET_WRITEBACK | PAGE_END_WRITEBACK |
PAGE_SET_ERROR;
extent_clear_unlock_delalloc(inode, start, end, locked_page,
clear_bits, page_ops);
extent_clear_unlock_delalloc(BTRFS_I(inode), start, end,
locked_page, clear_bits, page_ops);
return -ENOMEM;
}
......@@ -1468,7 +1470,8 @@ static noinline int run_delalloc_nocow(struct inode *inode,
path = btrfs_alloc_path();
if (!path) {
extent_clear_unlock_delalloc(inode, start, end, locked_page,
extent_clear_unlock_delalloc(BTRFS_I(inode), start, end,
locked_page,
EXTENT_LOCKED | EXTENT_DELALLOC |
EXTENT_DO_ACCOUNTING |
EXTENT_DEFRAG, PAGE_UNLOCK |
......@@ -1746,7 +1749,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
ret = btrfs_reloc_clone_csums(BTRFS_I(inode), cur_offset,
num_bytes);
extent_clear_unlock_delalloc(inode, cur_offset,
extent_clear_unlock_delalloc(BTRFS_I(inode), cur_offset,
cur_offset + num_bytes - 1,
locked_page, EXTENT_LOCKED |
EXTENT_DELALLOC |
......@@ -1783,7 +1786,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
btrfs_dec_nocow_writers(fs_info, disk_bytenr);
if (ret && cur_offset < end)
extent_clear_unlock_delalloc(inode, cur_offset, end,
extent_clear_unlock_delalloc(BTRFS_I(inode), cur_offset, end,
locked_page, EXTENT_LOCKED |
EXTENT_DELALLOC | EXTENT_DEFRAG |
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