Commit 8bab0a30 authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba

btrfs: remove the pg_offset parameter from btrfs_get_extent()

The parameter @pg_offset of btrfs_get_extent() is only utilized for
inlined extent, and we already have an ASSERT() and tree-checker, to
make sure we can only get inline extent at file offset 0.

Any invalid inline extent with non-zero file offset would be rejected by
tree-checker in the first place.

Thus the @pg_offset parameter is not really necessary, just remove it.
Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 90d35da6
...@@ -490,8 +490,7 @@ struct inode *btrfs_iget_path(struct super_block *s, u64 ino, ...@@ -490,8 +490,7 @@ struct inode *btrfs_iget_path(struct super_block *s, u64 ino,
struct btrfs_root *root, struct btrfs_path *path); struct btrfs_root *root, struct btrfs_path *path);
struct inode *btrfs_iget(struct super_block *s, u64 ino, struct btrfs_root *root); struct inode *btrfs_iget(struct super_block *s, u64 ino, 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, u64 start, u64 len);
u64 start, u64 len);
int btrfs_update_inode(struct btrfs_trans_handle *trans, int btrfs_update_inode(struct btrfs_trans_handle *trans,
struct btrfs_inode *inode); struct btrfs_inode *inode);
int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans, int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans,
......
...@@ -970,8 +970,7 @@ void clear_page_extent_mapped(struct page *page) ...@@ -970,8 +970,7 @@ void clear_page_extent_mapped(struct page *page)
folio_detach_private(folio); folio_detach_private(folio);
} }
static struct extent_map * static struct extent_map *__get_extent_map(struct inode *inode, struct page *page,
__get_extent_map(struct inode *inode, struct page *page, size_t pg_offset,
u64 start, u64 len, struct extent_map **em_cached) u64 start, u64 len, struct extent_map **em_cached)
{ {
struct extent_map *em; struct extent_map *em;
...@@ -988,7 +987,7 @@ __get_extent_map(struct inode *inode, struct page *page, size_t pg_offset, ...@@ -988,7 +987,7 @@ __get_extent_map(struct inode *inode, struct page *page, size_t pg_offset,
*em_cached = NULL; *em_cached = NULL;
} }
em = btrfs_get_extent(BTRFS_I(inode), page, pg_offset, start, len); em = btrfs_get_extent(BTRFS_I(inode), page, start, len);
if (em_cached && !IS_ERR(em)) { if (em_cached && !IS_ERR(em)) {
BUG_ON(*em_cached); BUG_ON(*em_cached);
refcount_inc(&em->refs); refcount_inc(&em->refs);
...@@ -1051,8 +1050,7 @@ static int btrfs_do_readpage(struct page *page, struct extent_map **em_cached, ...@@ -1051,8 +1050,7 @@ static int btrfs_do_readpage(struct page *page, struct extent_map **em_cached,
end_page_read(page, true, cur, iosize); end_page_read(page, true, cur, iosize);
break; break;
} }
em = __get_extent_map(inode, page, pg_offset, cur, em = __get_extent_map(inode, page, cur, end - cur + 1, em_cached);
end - cur + 1, em_cached);
if (IS_ERR(em)) { if (IS_ERR(em)) {
unlock_extent(tree, cur, end, NULL); unlock_extent(tree, cur, end, NULL);
end_page_read(page, false, cur, end + 1 - cur); end_page_read(page, false, cur, end + 1 - cur);
...@@ -1371,7 +1369,7 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode, ...@@ -1371,7 +1369,7 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode,
continue; continue;
} }
em = btrfs_get_extent(inode, NULL, 0, cur, len); em = btrfs_get_extent(inode, NULL, cur, len);
if (IS_ERR(em)) { if (IS_ERR(em)) {
ret = PTR_ERR_OR_ZERO(em); ret = PTR_ERR_OR_ZERO(em);
goto out_error; goto out_error;
......
...@@ -2176,7 +2176,7 @@ static int find_first_non_hole(struct btrfs_inode *inode, u64 *start, u64 *len) ...@@ -2176,7 +2176,7 @@ static int find_first_non_hole(struct btrfs_inode *inode, u64 *start, u64 *len)
struct extent_map *em; struct extent_map *em;
int ret = 0; int ret = 0;
em = btrfs_get_extent(inode, NULL, 0, em = btrfs_get_extent(inode, NULL,
round_down(*start, fs_info->sectorsize), round_down(*start, fs_info->sectorsize),
round_up(*len, fs_info->sectorsize)); round_up(*len, fs_info->sectorsize));
if (IS_ERR(em)) if (IS_ERR(em))
...@@ -2835,7 +2835,7 @@ static int btrfs_zero_range_check_range_boundary(struct btrfs_inode *inode, ...@@ -2835,7 +2835,7 @@ static int btrfs_zero_range_check_range_boundary(struct btrfs_inode *inode,
int ret; int ret;
offset = round_down(offset, sectorsize); offset = round_down(offset, sectorsize);
em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize); em = btrfs_get_extent(inode, NULL, offset, sectorsize);
if (IS_ERR(em)) if (IS_ERR(em))
return PTR_ERR(em); return PTR_ERR(em);
...@@ -2866,7 +2866,7 @@ static int btrfs_zero_range(struct inode *inode, ...@@ -2866,7 +2866,7 @@ static int btrfs_zero_range(struct inode *inode,
u64 bytes_to_reserve = 0; u64 bytes_to_reserve = 0;
bool space_reserved = false; bool space_reserved = false;
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, alloc_start, em = btrfs_get_extent(BTRFS_I(inode), NULL, alloc_start,
alloc_end - alloc_start); alloc_end - alloc_start);
if (IS_ERR(em)) { if (IS_ERR(em)) {
ret = PTR_ERR(em); ret = PTR_ERR(em);
...@@ -2909,8 +2909,7 @@ static int btrfs_zero_range(struct inode *inode, ...@@ -2909,8 +2909,7 @@ 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, alloc_start, em = btrfs_get_extent(BTRFS_I(inode), NULL, alloc_start, sectorsize);
sectorsize);
if (IS_ERR(em)) { if (IS_ERR(em)) {
ret = PTR_ERR(em); ret = PTR_ERR(em);
goto out; goto out;
...@@ -3126,7 +3125,7 @@ static long btrfs_fallocate(struct file *file, int mode, ...@@ -3126,7 +3125,7 @@ static long btrfs_fallocate(struct file *file, int mode,
/* First, check if we exceed the qgroup limit */ /* First, check if we exceed the qgroup limit */
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, cur_offset,
alloc_end - cur_offset); alloc_end - cur_offset);
if (IS_ERR(em)) { if (IS_ERR(em)) {
ret = PTR_ERR(em); ret = PTR_ERR(em);
......
...@@ -2632,7 +2632,7 @@ static int btrfs_find_new_delalloc_bytes(struct btrfs_inode *inode, ...@@ -2632,7 +2632,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, search_len); em = btrfs_get_extent(inode, NULL, search_start, search_len);
if (IS_ERR(em)) if (IS_ERR(em))
return PTR_ERR(em); return PTR_ERR(em);
...@@ -4907,8 +4907,7 @@ int btrfs_cont_expand(struct btrfs_inode *inode, loff_t oldsize, loff_t size) ...@@ -4907,8 +4907,7 @@ int btrfs_cont_expand(struct btrfs_inode *inode, loff_t oldsize, loff_t size)
&cached_state); &cached_state);
cur_offset = hole_start; cur_offset = hole_start;
while (1) { while (1) {
em = btrfs_get_extent(inode, NULL, 0, cur_offset, em = btrfs_get_extent(inode, NULL, cur_offset, block_end - cur_offset);
block_end - cur_offset);
if (IS_ERR(em)) { if (IS_ERR(em)) {
err = PTR_ERR(em); err = PTR_ERR(em);
em = NULL; em = NULL;
...@@ -6756,7 +6755,6 @@ static int read_inline_extent(struct btrfs_inode *inode, struct btrfs_path *path ...@@ -6756,7 +6755,6 @@ static int read_inline_extent(struct btrfs_inode *inode, struct btrfs_path *path
* *
* @inode: file to search in * @inode: file to search in
* @page: page to read extent data into if the extent is inline * @page: page to read extent data into if the extent is inline
* @pg_offset: offset into @page to copy to
* @start: file offset * @start: file offset
* @len: length of range starting at @start * @len: length of range starting at @start
* *
...@@ -6770,8 +6768,7 @@ static int read_inline_extent(struct btrfs_inode *inode, struct btrfs_path *path ...@@ -6770,8 +6768,7 @@ static int read_inline_extent(struct btrfs_inode *inode, struct btrfs_path *path
* Return: ERR_PTR on error, non-NULL extent_map on success. * 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, size_t pg_offset, struct page *page, u64 start, u64 len)
u64 start, u64 len)
{ {
struct btrfs_fs_info *fs_info = inode->root->fs_info; struct btrfs_fs_info *fs_info = inode->root->fs_info;
int ret = 0; int ret = 0;
...@@ -6914,7 +6911,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, ...@@ -6914,7 +6911,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
* ensured by tree-checker and inline extent creation path. * ensured by tree-checker and inline extent creation path.
* Thus all members representing file offsets should be zero. * Thus all members representing file offsets should be zero.
*/ */
ASSERT(pg_offset == 0);
ASSERT(extent_start == 0); ASSERT(extent_start == 0);
ASSERT(em->start == 0); ASSERT(em->start == 0);
...@@ -7555,7 +7551,7 @@ static int btrfs_dio_iomap_begin(struct inode *inode, loff_t start, ...@@ -7555,7 +7551,7 @@ static int btrfs_dio_iomap_begin(struct inode *inode, loff_t start,
if (ret < 0) if (ret < 0)
goto err; goto err;
em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, start, len); em = btrfs_get_extent(BTRFS_I(inode), NULL, start, len);
if (IS_ERR(em)) { if (IS_ERR(em)) {
ret = PTR_ERR(em); ret = PTR_ERR(em);
goto unlock_err; goto unlock_err;
...@@ -10164,7 +10160,7 @@ ssize_t btrfs_encoded_read(struct kiocb *iocb, struct iov_iter *iter, ...@@ -10164,7 +10160,7 @@ ssize_t btrfs_encoded_read(struct kiocb *iocb, struct iov_iter *iter,
cond_resched(); cond_resched();
} }
em = btrfs_get_extent(inode, NULL, 0, start, lockend - start + 1); em = btrfs_get_extent(inode, NULL, start, lockend - start + 1);
if (IS_ERR(em)) { if (IS_ERR(em)) {
ret = PTR_ERR(em); ret = PTR_ERR(em);
goto out_unlock_extent; goto out_unlock_extent;
...@@ -10744,7 +10740,7 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file, ...@@ -10744,7 +10740,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, start, len);
if (IS_ERR(em)) { if (IS_ERR(em)) {
ret = PTR_ERR(em); ret = PTR_ERR(em);
goto out; goto out;
......
...@@ -258,7 +258,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -258,7 +258,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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");
...@@ -278,7 +278,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -278,7 +278,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -316,7 +316,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -316,7 +316,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -339,7 +339,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -339,7 +339,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -367,7 +367,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -367,7 +367,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -396,7 +396,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -396,7 +396,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -418,7 +418,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -418,7 +418,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -452,7 +452,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -452,7 +452,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -481,7 +481,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -481,7 +481,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -511,7 +511,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -511,7 +511,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -544,7 +544,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -544,7 +544,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -579,7 +579,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -579,7 +579,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -613,7 +613,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -613,7 +613,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -648,7 +648,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -648,7 +648,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -675,7 +675,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -675,7 +675,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -710,7 +710,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -710,7 +710,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, sectorsize); em = btrfs_get_extent(BTRFS_I(inode), NULL, offset + 6, 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;
...@@ -737,7 +737,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -737,7 +737,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -770,7 +770,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -770,7 +770,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -850,7 +850,7 @@ static int test_hole_first(u32 sectorsize, u32 nodesize) ...@@ -850,7 +850,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); em = btrfs_get_extent(BTRFS_I(inode), NULL, 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;
...@@ -872,7 +872,7 @@ static int test_hole_first(u32 sectorsize, u32 nodesize) ...@@ -872,7 +872,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, 2 * sectorsize); em = btrfs_get_extent(BTRFS_I(inode), NULL, sectorsize, 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;
......
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