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

btrfs: make btrfs_set_extent_delalloc take btrfs_inode

Preparation to make btrfs_dirty_pages take btrfs_inode as parameter.
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 cd4c0bf9
...@@ -2926,7 +2926,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, ...@@ -2926,7 +2926,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
int btrfs_start_delalloc_snapshot(struct btrfs_root *root); int btrfs_start_delalloc_snapshot(struct btrfs_root *root);
int btrfs_start_delalloc_roots(struct btrfs_fs_info *fs_info, int nr); int btrfs_start_delalloc_roots(struct btrfs_fs_info *fs_info, int nr);
int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end, int btrfs_set_extent_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
unsigned int extra_bits, unsigned int extra_bits,
struct extent_state **cached_state); struct extent_state **cached_state);
int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
......
...@@ -546,7 +546,7 @@ int btrfs_dirty_pages(struct inode *inode, struct page **pages, ...@@ -546,7 +546,7 @@ int btrfs_dirty_pages(struct inode *inode, struct page **pages,
} }
} }
err = btrfs_set_extent_delalloc(inode, start_pos, end_of_last_block, err = btrfs_set_extent_delalloc(BTRFS_I(inode), start_pos, end_of_last_block,
extra_bits, cached); extra_bits, cached);
if (err) if (err)
return err; return err;
......
...@@ -2260,13 +2260,13 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans, ...@@ -2260,13 +2260,13 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans,
return 0; return 0;
} }
int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end, int btrfs_set_extent_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
unsigned int extra_bits, unsigned int extra_bits,
struct extent_state **cached_state) struct extent_state **cached_state)
{ {
WARN_ON(PAGE_ALIGNED(end)); WARN_ON(PAGE_ALIGNED(end));
return set_extent_delalloc(&BTRFS_I(inode)->io_tree, start, end, return set_extent_delalloc(&inode->io_tree, start, end, extra_bits,
extra_bits, cached_state); cached_state);
} }
/* see btrfs_writepage_start_hook for details on why this is required */ /* see btrfs_writepage_start_hook for details on why this is required */
...@@ -2363,7 +2363,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ...@@ -2363,7 +2363,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
goto again; goto again;
} }
ret = btrfs_set_extent_delalloc(inode, page_start, page_end, 0, ret = btrfs_set_extent_delalloc(BTRFS_I(inode), page_start, page_end, 0,
&cached_state); &cached_state);
if (ret) if (ret)
goto out_reserved; goto out_reserved;
...@@ -4581,7 +4581,7 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len, ...@@ -4581,7 +4581,7 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len,
EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG, EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG,
0, 0, &cached_state); 0, 0, &cached_state);
ret = btrfs_set_extent_delalloc(inode, block_start, block_end, 0, ret = btrfs_set_extent_delalloc(BTRFS_I(inode), block_start, block_end, 0,
&cached_state); &cached_state);
if (ret) { if (ret) {
unlock_extent_cached(io_tree, block_start, block_end, unlock_extent_cached(io_tree, block_start, block_end,
...@@ -8296,7 +8296,7 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf) ...@@ -8296,7 +8296,7 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)
EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING | EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING |
EXTENT_DEFRAG, 0, 0, &cached_state); EXTENT_DEFRAG, 0, 0, &cached_state);
ret2 = btrfs_set_extent_delalloc(inode, page_start, end, 0, ret2 = btrfs_set_extent_delalloc(BTRFS_I(inode), page_start, end, 0,
&cached_state); &cached_state);
if (ret2) { if (ret2) {
unlock_extent_cached(io_tree, page_start, page_end, unlock_extent_cached(io_tree, page_start, page_end,
......
...@@ -84,7 +84,8 @@ static int copy_inline_to_page(struct inode *inode, ...@@ -84,7 +84,8 @@ static int copy_inline_to_page(struct inode *inode,
clear_extent_bit(&BTRFS_I(inode)->io_tree, file_offset, range_end, clear_extent_bit(&BTRFS_I(inode)->io_tree, file_offset, range_end,
EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG, EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG,
0, 0, NULL); 0, 0, NULL);
ret = btrfs_set_extent_delalloc(inode, file_offset, range_end, 0, NULL); ret = btrfs_set_extent_delalloc(BTRFS_I(inode), file_offset, range_end,
0, NULL);
if (ret) if (ret)
goto out_unlock; goto out_unlock;
......
...@@ -2754,8 +2754,8 @@ static int relocate_file_extent_cluster(struct inode *inode, ...@@ -2754,8 +2754,8 @@ static int relocate_file_extent_cluster(struct inode *inode,
nr++; nr++;
} }
ret = btrfs_set_extent_delalloc(inode, page_start, page_end, 0, ret = btrfs_set_extent_delalloc(BTRFS_I(inode), page_start,
NULL); page_end, 0, NULL);
if (ret) { if (ret) {
unlock_page(page); unlock_page(page);
put_page(page); put_page(page);
......
...@@ -954,8 +954,8 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize) ...@@ -954,8 +954,8 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
btrfs_test_inode_set_ops(inode); btrfs_test_inode_set_ops(inode);
/* [BTRFS_MAX_EXTENT_SIZE] */ /* [BTRFS_MAX_EXTENT_SIZE] */
ret = btrfs_set_extent_delalloc(inode, 0, BTRFS_MAX_EXTENT_SIZE - 1, 0, ret = btrfs_set_extent_delalloc(BTRFS_I(inode), 0,
NULL); BTRFS_MAX_EXTENT_SIZE - 1, 0, NULL);
if (ret) { if (ret) {
test_err("btrfs_set_extent_delalloc returned %d", ret); test_err("btrfs_set_extent_delalloc returned %d", ret);
goto out; goto out;
...@@ -968,7 +968,7 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize) ...@@ -968,7 +968,7 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
} }
/* [BTRFS_MAX_EXTENT_SIZE][sectorsize] */ /* [BTRFS_MAX_EXTENT_SIZE][sectorsize] */
ret = btrfs_set_extent_delalloc(inode, BTRFS_MAX_EXTENT_SIZE, ret = btrfs_set_extent_delalloc(BTRFS_I(inode), BTRFS_MAX_EXTENT_SIZE,
BTRFS_MAX_EXTENT_SIZE + sectorsize - 1, BTRFS_MAX_EXTENT_SIZE + sectorsize - 1,
0, NULL); 0, NULL);
if (ret) { if (ret) {
...@@ -999,7 +999,7 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize) ...@@ -999,7 +999,7 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
} }
/* [BTRFS_MAX_EXTENT_SIZE][sectorsize] */ /* [BTRFS_MAX_EXTENT_SIZE][sectorsize] */
ret = btrfs_set_extent_delalloc(inode, BTRFS_MAX_EXTENT_SIZE >> 1, ret = btrfs_set_extent_delalloc(BTRFS_I(inode), BTRFS_MAX_EXTENT_SIZE >> 1,
(BTRFS_MAX_EXTENT_SIZE >> 1) (BTRFS_MAX_EXTENT_SIZE >> 1)
+ sectorsize - 1, + sectorsize - 1,
0, NULL); 0, NULL);
...@@ -1017,7 +1017,7 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize) ...@@ -1017,7 +1017,7 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
/* /*
* [BTRFS_MAX_EXTENT_SIZE+sectorsize][sectorsize HOLE][BTRFS_MAX_EXTENT_SIZE+sectorsize] * [BTRFS_MAX_EXTENT_SIZE+sectorsize][sectorsize HOLE][BTRFS_MAX_EXTENT_SIZE+sectorsize]
*/ */
ret = btrfs_set_extent_delalloc(inode, ret = btrfs_set_extent_delalloc(BTRFS_I(inode),
BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize, BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize,
(BTRFS_MAX_EXTENT_SIZE << 1) + 3 * sectorsize - 1, (BTRFS_MAX_EXTENT_SIZE << 1) + 3 * sectorsize - 1,
0, NULL); 0, NULL);
...@@ -1035,7 +1035,7 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize) ...@@ -1035,7 +1035,7 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
/* /*
* [BTRFS_MAX_EXTENT_SIZE+sectorsize][sectorsize][BTRFS_MAX_EXTENT_SIZE+sectorsize] * [BTRFS_MAX_EXTENT_SIZE+sectorsize][sectorsize][BTRFS_MAX_EXTENT_SIZE+sectorsize]
*/ */
ret = btrfs_set_extent_delalloc(inode, ret = btrfs_set_extent_delalloc(BTRFS_I(inode),
BTRFS_MAX_EXTENT_SIZE + sectorsize, BTRFS_MAX_EXTENT_SIZE + sectorsize,
BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize - 1, 0, NULL); BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize - 1, 0, NULL);
if (ret) { if (ret) {
...@@ -1069,7 +1069,7 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize) ...@@ -1069,7 +1069,7 @@ static int test_extent_accounting(u32 sectorsize, u32 nodesize)
* Refill the hole again just for good measure, because I thought it * Refill the hole again just for good measure, because I thought it
* might fail and I'd rather satisfy my paranoia at this point. * might fail and I'd rather satisfy my paranoia at this point.
*/ */
ret = btrfs_set_extent_delalloc(inode, ret = btrfs_set_extent_delalloc(BTRFS_I(inode),
BTRFS_MAX_EXTENT_SIZE + sectorsize, BTRFS_MAX_EXTENT_SIZE + sectorsize,
BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize - 1, 0, NULL); BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize - 1, 0, NULL);
if (ret) { if (ret) {
......
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