Commit 39b07b5d authored by Omar Sandoval's avatar Omar Sandoval Committed by David Sterba

btrfs: drop create parameter to btrfs_get_extent()

We only pass this as 1 from __extent_writepage_io(). The parameter
basically means "pretend I didn't pass in a page". This is silly since
we can simply not pass in the page. Get rid of the parameter from
btrfs_get_extent(), and since it's used as a get_extent_t callback,
remove it from get_extent_t and btree_get_extent(), neither of which
need it.

While we're here, let's document btrfs_get_extent().
Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent f95d713b
...@@ -2875,7 +2875,7 @@ struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location, ...@@ -2875,7 +2875,7 @@ struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,
struct btrfs_root *root); struct btrfs_root *root);
struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
struct page *page, size_t pg_offset, struct page *page, size_t pg_offset,
u64 start, u64 end, int create); u64 start, u64 end);
int btrfs_update_inode(struct btrfs_trans_handle *trans, int btrfs_update_inode(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct inode *inode); struct inode *inode);
......
...@@ -202,8 +202,8 @@ void btrfs_set_buffer_lockdep_class(u64 objectid, struct extent_buffer *eb, ...@@ -202,8 +202,8 @@ void btrfs_set_buffer_lockdep_class(u64 objectid, struct extent_buffer *eb,
* that covers the entire device * that covers the entire device
*/ */
struct extent_map *btree_get_extent(struct btrfs_inode *inode, struct extent_map *btree_get_extent(struct btrfs_inode *inode,
struct page *page, size_t pg_offset, u64 start, u64 len, struct page *page, size_t pg_offset,
int create) u64 start, u64 len)
{ {
struct extent_map_tree *em_tree = &inode->extent_tree; struct extent_map_tree *em_tree = &inode->extent_tree;
struct extent_map *em; struct extent_map *em;
......
...@@ -134,8 +134,8 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans, ...@@ -134,8 +134,8 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
int btree_lock_page_hook(struct page *page, void *data, int btree_lock_page_hook(struct page *page, void *data,
void (*flush_fn)(void *)); void (*flush_fn)(void *));
struct extent_map *btree_get_extent(struct btrfs_inode *inode, struct extent_map *btree_get_extent(struct btrfs_inode *inode,
struct page *page, size_t pg_offset, u64 start, u64 len, struct page *page, size_t pg_offset,
int create); u64 start, u64 len);
int btrfs_get_num_tolerated_disk_barrier_failures(u64 flags); int btrfs_get_num_tolerated_disk_barrier_failures(u64 flags);
int __init btrfs_end_io_wq_init(void); int __init btrfs_end_io_wq_init(void);
void __cold btrfs_end_io_wq_exit(void); void __cold btrfs_end_io_wq_exit(void);
......
...@@ -3043,7 +3043,7 @@ __get_extent_map(struct inode *inode, struct page *page, size_t pg_offset, ...@@ -3043,7 +3043,7 @@ __get_extent_map(struct inode *inode, struct page *page, size_t pg_offset,
*em_cached = NULL; *em_cached = NULL;
} }
em = get_extent(BTRFS_I(inode), page, pg_offset, start, len, 0); em = get_extent(BTRFS_I(inode), page, pg_offset, start, len);
if (em_cached && !IS_ERR_OR_NULL(em)) { if (em_cached && !IS_ERR_OR_NULL(em)) {
BUG_ON(*em_cached); BUG_ON(*em_cached);
refcount_inc(&em->refs); refcount_inc(&em->refs);
...@@ -3466,8 +3466,8 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode, ...@@ -3466,8 +3466,8 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
page_end, 1); page_end, 1);
break; break;
} }
em = btrfs_get_extent(BTRFS_I(inode), page, pg_offset, cur, em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, cur,
end - cur + 1, 1); end - cur + 1);
if (IS_ERR_OR_NULL(em)) { if (IS_ERR_OR_NULL(em)) {
SetPageError(page); SetPageError(page);
ret = PTR_ERR_OR_ZERO(em); ret = PTR_ERR_OR_ZERO(em);
......
...@@ -183,10 +183,8 @@ static inline int extent_compress_type(unsigned long bio_flags) ...@@ -183,10 +183,8 @@ static inline int extent_compress_type(unsigned long bio_flags)
struct extent_map_tree; struct extent_map_tree;
typedef struct extent_map *(get_extent_t)(struct btrfs_inode *inode, typedef struct extent_map *(get_extent_t)(struct btrfs_inode *inode,
struct page *page, struct page *page, size_t pg_offset,
size_t pg_offset, u64 start, u64 len);
u64 start, u64 len,
int create);
int try_release_extent_mapping(struct page *page, gfp_t mask); int try_release_extent_mapping(struct page *page, gfp_t mask);
int try_release_extent_buffer(struct page *page); int try_release_extent_buffer(struct page *page);
......
...@@ -477,8 +477,7 @@ static int btrfs_find_new_delalloc_bytes(struct btrfs_inode *inode, ...@@ -477,8 +477,7 @@ static int btrfs_find_new_delalloc_bytes(struct btrfs_inode *inode,
u64 em_len; u64 em_len;
int ret = 0; int ret = 0;
em = btrfs_get_extent(inode, NULL, 0, search_start, em = btrfs_get_extent(inode, NULL, 0, search_start, search_len);
search_len, 0);
if (IS_ERR(em)) if (IS_ERR(em))
return PTR_ERR(em); return PTR_ERR(em);
...@@ -2390,7 +2389,7 @@ static int find_first_non_hole(struct inode *inode, u64 *start, u64 *len) ...@@ -2390,7 +2389,7 @@ static int find_first_non_hole(struct inode *inode, u64 *start, u64 *len)
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, em = btrfs_get_extent(BTRFS_I(inode), NULL, 0,
round_down(*start, fs_info->sectorsize), round_down(*start, fs_info->sectorsize),
round_up(*len, fs_info->sectorsize), 0); round_up(*len, fs_info->sectorsize));
if (IS_ERR(em)) if (IS_ERR(em))
return PTR_ERR(em); return PTR_ERR(em);
...@@ -2957,7 +2956,7 @@ static int btrfs_zero_range_check_range_boundary(struct inode *inode, ...@@ -2957,7 +2956,7 @@ static int btrfs_zero_range_check_range_boundary(struct inode *inode,
int ret; int ret;
offset = round_down(offset, sectorsize); offset = round_down(offset, sectorsize);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) if (IS_ERR(em))
return PTR_ERR(em); return PTR_ERR(em);
...@@ -2990,8 +2989,8 @@ static int btrfs_zero_range(struct inode *inode, ...@@ -2990,8 +2989,8 @@ static int btrfs_zero_range(struct inode *inode,
inode_dio_wait(inode); inode_dio_wait(inode);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, alloc_start,
alloc_start, alloc_end - alloc_start, 0); alloc_end - alloc_start);
if (IS_ERR(em)) { if (IS_ERR(em)) {
ret = PTR_ERR(em); ret = PTR_ERR(em);
goto out; goto out;
...@@ -3034,8 +3033,8 @@ static int btrfs_zero_range(struct inode *inode, ...@@ -3034,8 +3033,8 @@ static int btrfs_zero_range(struct inode *inode,
if (BTRFS_BYTES_TO_BLKS(fs_info, offset) == if (BTRFS_BYTES_TO_BLKS(fs_info, offset) ==
BTRFS_BYTES_TO_BLKS(fs_info, offset + len - 1)) { BTRFS_BYTES_TO_BLKS(fs_info, offset + len - 1)) {
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, alloc_start,
alloc_start, sectorsize, 0); sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
ret = PTR_ERR(em); ret = PTR_ERR(em);
goto out; goto out;
...@@ -3273,7 +3272,7 @@ static long btrfs_fallocate(struct file *file, int mode, ...@@ -3273,7 +3272,7 @@ static long btrfs_fallocate(struct file *file, int mode,
INIT_LIST_HEAD(&reserve_list); INIT_LIST_HEAD(&reserve_list);
while (cur_offset < alloc_end) { while (cur_offset < alloc_end) {
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, cur_offset, em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, cur_offset,
alloc_end - cur_offset, 0); alloc_end - cur_offset);
if (IS_ERR(em)) { if (IS_ERR(em)) {
ret = PTR_ERR(em); ret = PTR_ERR(em);
break; break;
......
...@@ -4504,7 +4504,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) ...@@ -4504,7 +4504,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size)
cur_offset = hole_start; cur_offset = hole_start;
while (1) { while (1) {
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, cur_offset, em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, cur_offset,
block_end - cur_offset, 0); block_end - cur_offset);
if (IS_ERR(em)) { if (IS_ERR(em)) {
err = PTR_ERR(em); err = PTR_ERR(em);
em = NULL; em = NULL;
...@@ -6283,18 +6283,27 @@ static noinline int uncompress_inline(struct btrfs_path *path, ...@@ -6283,18 +6283,27 @@ static noinline int uncompress_inline(struct btrfs_path *path,
return ret; return ret;
} }
/* /**
* a bit scary, this does extent mapping from logical file offset to the disk. * btrfs_get_extent - Lookup the first extent overlapping a range in a file.
* the ugly parts come from merging extents from the disk with the in-ram * @inode: file to search in
* representation. This gets more complex because of the data=ordered code, * @page: page to read extent data into if the extent is inline
* where the in-ram extents might be locked pending data=ordered completion. * @pg_offset: offset into @page to copy to
* @start: file offset
* @len: length of range starting at @start
*
* This returns the first &struct extent_map which overlaps with the given
* range, reading it from the B-tree and caching it if necessary. Note that
* there may be more extents which overlap the given range after the returned
* extent_map.
* *
* This also copies inline extents directly into the page. * If @page is not NULL and the extent is inline, this also reads the extent
* data directly into the page and marks the extent up to date in the io_tree.
*
* Return: ERR_PTR on error, non-NULL extent_map on success.
*/ */
struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
struct page *page, struct page *page, size_t pg_offset,
size_t pg_offset, u64 start, u64 len, u64 start, u64 len)
int create)
{ {
struct btrfs_fs_info *fs_info = inode->root->fs_info; struct btrfs_fs_info *fs_info = inode->root->fs_info;
int ret; int ret;
...@@ -6311,7 +6320,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, ...@@ -6311,7 +6320,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
struct extent_map *em = NULL; struct extent_map *em = NULL;
struct extent_map_tree *em_tree = &inode->extent_tree; struct extent_map_tree *em_tree = &inode->extent_tree;
struct extent_io_tree *io_tree = &inode->io_tree; struct extent_io_tree *io_tree = &inode->io_tree;
const bool new_inline = !page || create;
read_lock(&em_tree->lock); read_lock(&em_tree->lock);
em = lookup_extent_mapping(em_tree, start, len); em = lookup_extent_mapping(em_tree, start, len);
...@@ -6434,8 +6442,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, ...@@ -6434,8 +6442,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
goto insert; goto insert;
} }
btrfs_extent_item_to_extent_map(inode, path, item, btrfs_extent_item_to_extent_map(inode, path, item, !page, em);
new_inline, em);
if (extent_type == BTRFS_FILE_EXTENT_REG || if (extent_type == BTRFS_FILE_EXTENT_REG ||
extent_type == BTRFS_FILE_EXTENT_PREALLOC) { extent_type == BTRFS_FILE_EXTENT_PREALLOC) {
...@@ -6447,7 +6454,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, ...@@ -6447,7 +6454,7 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
size_t extent_offset; size_t extent_offset;
size_t copy_size; size_t copy_size;
if (new_inline) if (!page)
goto out; goto out;
size = btrfs_file_extent_ram_bytes(leaf, item); size = btrfs_file_extent_ram_bytes(leaf, item);
...@@ -6530,7 +6537,7 @@ struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode, ...@@ -6530,7 +6537,7 @@ struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode,
u64 delalloc_end; u64 delalloc_end;
int err = 0; int err = 0;
em = btrfs_get_extent(inode, NULL, 0, start, len, 0); em = btrfs_get_extent(inode, NULL, 0, start, len);
if (IS_ERR(em)) if (IS_ERR(em))
return em; return em;
/* /*
...@@ -7155,7 +7162,7 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, ...@@ -7155,7 +7162,7 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
goto err; goto err;
} }
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, start, len, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, start, len);
if (IS_ERR(em)) { if (IS_ERR(em)) {
ret = PTR_ERR(em); ret = PTR_ERR(em);
goto unlock_err; goto unlock_err;
...@@ -10166,7 +10173,7 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file, ...@@ -10166,7 +10173,7 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file,
struct btrfs_block_group *bg; struct btrfs_block_group *bg;
u64 len = isize - start; u64 len = isize - start;
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, start, len, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, start, len);
if (IS_ERR(em)) { if (IS_ERR(em)) {
ret = PTR_ERR(em); ret = PTR_ERR(em);
goto out; goto out;
......
...@@ -1128,7 +1128,7 @@ static struct extent_map *defrag_lookup_extent(struct inode *inode, u64 start) ...@@ -1128,7 +1128,7 @@ static struct extent_map *defrag_lookup_extent(struct inode *inode, u64 start)
/* get the big lock and read metadata off disk */ /* get the big lock and read metadata off disk */
lock_extent_bits(io_tree, start, end, &cached); lock_extent_bits(io_tree, start, end, &cached);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, start, len, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, start, len);
unlock_extent_cached(io_tree, start, end, &cached); unlock_extent_cached(io_tree, start, end, &cached);
if (IS_ERR(em)) if (IS_ERR(em))
......
...@@ -263,7 +263,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -263,7 +263,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
/* First with no extents */ /* First with no extents */
BTRFS_I(inode)->root = root; BTRFS_I(inode)->root = root;
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, 0, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, 0, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
em = NULL; em = NULL;
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
...@@ -283,7 +283,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -283,7 +283,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
*/ */
setup_file_extents(root, sectorsize); setup_file_extents(root, sectorsize);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, 0, (u64)-1, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, 0, (u64)-1);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -305,7 +305,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -305,7 +305,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
offset = em->start + em->len; offset = em->start + em->len;
free_extent_map(em); free_extent_map(em);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -333,7 +333,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -333,7 +333,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
offset = em->start + em->len; offset = em->start + em->len;
free_extent_map(em); free_extent_map(em);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -356,7 +356,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -356,7 +356,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
free_extent_map(em); free_extent_map(em);
/* Regular extent */ /* Regular extent */
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -384,7 +384,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -384,7 +384,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
free_extent_map(em); free_extent_map(em);
/* The next 3 are split extents */ /* The next 3 are split extents */
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -413,7 +413,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -413,7 +413,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
offset = em->start + em->len; offset = em->start + em->len;
free_extent_map(em); free_extent_map(em);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -435,7 +435,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -435,7 +435,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
offset = em->start + em->len; offset = em->start + em->len;
free_extent_map(em); free_extent_map(em);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -469,7 +469,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -469,7 +469,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
free_extent_map(em); free_extent_map(em);
/* Prealloc extent */ /* Prealloc extent */
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -498,7 +498,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -498,7 +498,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
free_extent_map(em); free_extent_map(em);
/* The next 3 are a half written prealloc extent */ /* The next 3 are a half written prealloc extent */
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -528,7 +528,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -528,7 +528,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
offset = em->start + em->len; offset = em->start + em->len;
free_extent_map(em); free_extent_map(em);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -561,7 +561,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -561,7 +561,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
offset = em->start + em->len; offset = em->start + em->len;
free_extent_map(em); free_extent_map(em);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -596,7 +596,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -596,7 +596,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
free_extent_map(em); free_extent_map(em);
/* Now for the compressed extent */ /* Now for the compressed extent */
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -630,7 +630,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -630,7 +630,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
free_extent_map(em); free_extent_map(em);
/* Split compressed extent */ /* Split compressed extent */
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -665,7 +665,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -665,7 +665,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
offset = em->start + em->len; offset = em->start + em->len;
free_extent_map(em); free_extent_map(em);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -692,7 +692,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -692,7 +692,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
offset = em->start + em->len; offset = em->start + em->len;
free_extent_map(em); free_extent_map(em);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -727,8 +727,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -727,8 +727,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
free_extent_map(em); free_extent_map(em);
/* A hole between regular extents but no hole extent */ /* A hole between regular extents but no hole extent */
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset + 6, em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset + 6, sectorsize);
sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -755,7 +754,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -755,7 +754,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
offset = em->start + em->len; offset = em->start + em->len;
free_extent_map(em); free_extent_map(em);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, SZ_4M, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, SZ_4M);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -788,7 +787,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -788,7 +787,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
offset = em->start + em->len; offset = em->start + em->len;
free_extent_map(em); free_extent_map(em);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -872,7 +871,7 @@ static int test_hole_first(u32 sectorsize, u32 nodesize) ...@@ -872,7 +871,7 @@ static int test_hole_first(u32 sectorsize, u32 nodesize)
insert_inode_item_key(root); insert_inode_item_key(root);
insert_extent(root, sectorsize, sectorsize, sectorsize, 0, sectorsize, insert_extent(root, sectorsize, sectorsize, sectorsize, 0, sectorsize,
sectorsize, BTRFS_FILE_EXTENT_REG, 0, 1); sectorsize, BTRFS_FILE_EXTENT_REG, 0, 1);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, 0, 2 * sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, 0, 2 * sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
goto out; goto out;
...@@ -894,8 +893,7 @@ static int test_hole_first(u32 sectorsize, u32 nodesize) ...@@ -894,8 +893,7 @@ static int test_hole_first(u32 sectorsize, u32 nodesize)
} }
free_extent_map(em); free_extent_map(em);
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, sectorsize, em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, sectorsize, 2 * sectorsize);
2 * sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_err("got an error when we shouldn't have"); test_err("got an error when we shouldn't have");
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