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

btrfs: Make get_extent_t take btrfs_inode

In addition to changing the signature, this patch also switches
all the functions which are used as an argument to also take btrfs_inode.
Namely those are: btrfs_get_extent and btrfs_get_extent_filemap.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 1c8c9c52
...@@ -3100,9 +3100,9 @@ struct btrfs_delalloc_work *btrfs_alloc_delalloc_work(struct inode *inode, ...@@ -3100,9 +3100,9 @@ struct btrfs_delalloc_work *btrfs_alloc_delalloc_work(struct inode *inode,
int delay_iput); int delay_iput);
void btrfs_wait_and_free_delalloc_work(struct btrfs_delalloc_work *work); void btrfs_wait_and_free_delalloc_work(struct btrfs_delalloc_work *work);
struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *page, struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode,
size_t pg_offset, u64 start, u64 len, struct page *page, size_t pg_offset, u64 start,
int create); u64 len, int create);
noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len, noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
u64 *orig_start, u64 *orig_block_len, u64 *orig_start, u64 *orig_block_len,
u64 *ram_bytes); u64 *ram_bytes);
...@@ -3166,9 +3166,9 @@ void btrfs_destroy_cachep(void); ...@@ -3166,9 +3166,9 @@ void btrfs_destroy_cachep(void);
long btrfs_ioctl_trans_end(struct file *file); long btrfs_ioctl_trans_end(struct file *file);
struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location, struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,
struct btrfs_root *root, int *was_new); struct btrfs_root *root, int *was_new);
struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page, struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
size_t pg_offset, u64 start, u64 end, struct page *page, size_t pg_offset,
int create); u64 start, u64 end, int create);
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);
......
...@@ -219,12 +219,12 @@ void btrfs_set_buffer_lockdep_class(u64 objectid, struct extent_buffer *eb, ...@@ -219,12 +219,12 @@ void btrfs_set_buffer_lockdep_class(u64 objectid, struct extent_buffer *eb,
* extents on the btree inode are pretty simple, there's one extent * extents on the btree inode are pretty simple, there's one extent
* that covers the entire device * that covers the entire device
*/ */
static struct extent_map *btree_get_extent(struct inode *inode, static 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, u64 start, u64 len,
int create) int create)
{ {
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; struct extent_map_tree *em_tree = &inode->extent_tree;
struct extent_map *em; struct extent_map *em;
int ret; int ret;
......
...@@ -2860,7 +2860,7 @@ __get_extent_map(struct inode *inode, struct page *page, size_t pg_offset, ...@@ -2860,7 +2860,7 @@ __get_extent_map(struct inode *inode, struct page *page, size_t pg_offset,
*em_cached = NULL; *em_cached = NULL;
} }
em = get_extent(inode, page, pg_offset, start, len, 0); em = get_extent(BTRFS_I(inode), page, pg_offset, start, len, 0);
if (em_cached && !IS_ERR_OR_NULL(em)) { if (em_cached && !IS_ERR_OR_NULL(em)) {
BUG_ON(*em_cached); BUG_ON(*em_cached);
atomic_inc(&em->refs); atomic_inc(&em->refs);
...@@ -3373,7 +3373,7 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode, ...@@ -3373,7 +3373,7 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
page_end, NULL, 1); page_end, NULL, 1);
break; break;
} }
em = epd->get_extent(inode, page, pg_offset, cur, em = epd->get_extent(BTRFS_I(inode), page, pg_offset, cur,
end - cur + 1, 1); end - cur + 1, 1);
if (IS_ERR_OR_NULL(em)) { if (IS_ERR_OR_NULL(em)) {
SetPageError(page); SetPageError(page);
...@@ -4338,7 +4338,7 @@ static struct extent_map *get_extent_skip_holes(struct inode *inode, ...@@ -4338,7 +4338,7 @@ static struct extent_map *get_extent_skip_holes(struct inode *inode,
if (len == 0) if (len == 0)
break; break;
len = ALIGN(len, sectorsize); len = ALIGN(len, sectorsize);
em = get_extent(inode, NULL, 0, offset, len, 0); em = get_extent(BTRFS_I(inode), NULL, 0, offset, len, 0);
if (IS_ERR_OR_NULL(em)) if (IS_ERR_OR_NULL(em))
return em; return em;
......
...@@ -211,7 +211,7 @@ static inline int extent_compress_type(unsigned long bio_flags) ...@@ -211,7 +211,7 @@ 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 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,
......
...@@ -2341,7 +2341,7 @@ static int find_first_non_hole(struct inode *inode, u64 *start, u64 *len) ...@@ -2341,7 +2341,7 @@ static int find_first_non_hole(struct 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, *start, *len, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, *start, *len, 0);
if (IS_ERR_OR_NULL(em)) { if (IS_ERR_OR_NULL(em)) {
if (!em) if (!em)
ret = -ENOMEM; ret = -ENOMEM;
...@@ -2833,7 +2833,7 @@ static long btrfs_fallocate(struct file *file, int mode, ...@@ -2833,7 +2833,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 */
INIT_LIST_HEAD(&reserve_list); INIT_LIST_HEAD(&reserve_list);
while (1) { while (1) {
em = btrfs_get_extent(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, 0);
if (IS_ERR_OR_NULL(em)) { if (IS_ERR_OR_NULL(em)) {
if (!em) if (!em)
...@@ -2960,7 +2960,8 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int whence) ...@@ -2960,7 +2960,8 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int whence)
&cached_state); &cached_state);
while (start < inode->i_size) { while (start < inode->i_size) {
em = btrfs_get_extent_fiemap(inode, NULL, 0, start, len, 0); em = btrfs_get_extent_fiemap(BTRFS_I(inode), NULL, 0,
start, len, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
ret = PTR_ERR(em); ret = PTR_ERR(em);
em = NULL; em = NULL;
......
...@@ -4852,7 +4852,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) ...@@ -4852,7 +4852,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(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, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
err = PTR_ERR(em); err = PTR_ERR(em);
...@@ -6732,25 +6732,26 @@ static noinline int uncompress_inline(struct btrfs_path *path, ...@@ -6732,25 +6732,26 @@ static noinline int uncompress_inline(struct btrfs_path *path,
* This also copies inline extents directly into the page. * This also copies inline extents directly into the page.
*/ */
struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page, struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
struct page *page,
size_t pg_offset, u64 start, u64 len, size_t pg_offset, u64 start, u64 len,
int create) int create)
{ {
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
int ret; int ret;
int err = 0; int err = 0;
u64 extent_start = 0; u64 extent_start = 0;
u64 extent_end = 0; u64 extent_end = 0;
u64 objectid = btrfs_ino(BTRFS_I(inode)); u64 objectid = btrfs_ino(inode);
u32 found_type; u32 found_type;
struct btrfs_path *path = NULL; struct btrfs_path *path = NULL;
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = inode->root;
struct btrfs_file_extent_item *item; struct btrfs_file_extent_item *item;
struct extent_buffer *leaf; struct extent_buffer *leaf;
struct btrfs_key found_key; struct btrfs_key found_key;
struct extent_map *em = NULL; struct extent_map *em = NULL;
struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; struct extent_map_tree *em_tree = &inode->extent_tree;
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; struct extent_io_tree *io_tree = &inode->io_tree;
struct btrfs_trans_handle *trans = NULL; struct btrfs_trans_handle *trans = NULL;
const bool new_inline = !page || create; const bool new_inline = !page || create;
...@@ -6863,7 +6864,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page, ...@@ -6863,7 +6864,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
goto not_found_em; goto not_found_em;
} }
btrfs_extent_item_to_extent_map(BTRFS_I(inode), path, item, btrfs_extent_item_to_extent_map(inode, path, item,
new_inline, em); new_inline, em);
if (found_type == BTRFS_FILE_EXTENT_REG || if (found_type == BTRFS_FILE_EXTENT_REG ||
...@@ -7000,7 +7001,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page, ...@@ -7000,7 +7001,7 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
write_unlock(&em_tree->lock); write_unlock(&em_tree->lock);
out: out:
trace_btrfs_get_extent(root, BTRFS_I(inode), em); trace_btrfs_get_extent(root, inode, em);
btrfs_free_path(path); btrfs_free_path(path);
if (trans) { if (trans) {
...@@ -7016,7 +7017,8 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page, ...@@ -7016,7 +7017,8 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page,
return em; return em;
} }
struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *page, struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode,
struct page *page,
size_t pg_offset, u64 start, u64 len, size_t pg_offset, u64 start, u64 len,
int create) int create)
{ {
...@@ -7055,7 +7057,7 @@ struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *pag ...@@ -7055,7 +7057,7 @@ struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *pag
em = NULL; em = NULL;
/* ok, we didn't find anything, lets look for delalloc */ /* ok, we didn't find anything, lets look for delalloc */
found = count_range_bits(&BTRFS_I(inode)->io_tree, &range_start, found = count_range_bits(&inode->io_tree, &range_start,
end, len, EXTENT_DELALLOC, 1); end, len, EXTENT_DELALLOC, 1);
found_end = range_start + found; found_end = range_start + found;
if (found_end < range_start) if (found_end < range_start)
...@@ -7625,7 +7627,7 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, ...@@ -7625,7 +7627,7 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
goto err; goto err;
} }
em = btrfs_get_extent(inode, NULL, 0, start, len, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, start, len, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
ret = PTR_ERR(em); ret = PTR_ERR(em);
goto unlock_err; goto unlock_err;
......
...@@ -1009,7 +1009,7 @@ static struct extent_map *defrag_lookup_extent(struct inode *inode, u64 start) ...@@ -1009,7 +1009,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(inode, NULL, 0, start, len, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, start, len, 0);
unlock_extent_cached(io_tree, start, end, &cached, GFP_NOFS); unlock_extent_cached(io_tree, start, end, &cached, GFP_NOFS);
if (IS_ERR(em)) if (IS_ERR(em))
......
...@@ -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)
/* First with no extents */ /* First with no extents */
BTRFS_I(inode)->root = root; BTRFS_I(inode)->root = root;
em = btrfs_get_extent(inode, NULL, 0, 0, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, 0, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
em = NULL; em = NULL;
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
...@@ -302,7 +302,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -302,7 +302,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(inode, NULL, 0, 0, (u64)-1, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, 0, (u64)-1, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -323,7 +323,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -323,7 +323,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -350,7 +350,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -350,7 +350,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -372,7 +372,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -372,7 +372,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -399,7 +399,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -399,7 +399,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -428,7 +428,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -428,7 +428,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -450,7 +450,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -450,7 +450,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -484,7 +484,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -484,7 +484,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -513,7 +513,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -513,7 +513,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -543,7 +543,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -543,7 +543,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -576,7 +576,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -576,7 +576,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -611,7 +611,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -611,7 +611,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -645,7 +645,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -645,7 +645,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -680,7 +680,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -680,7 +680,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -707,7 +707,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -707,7 +707,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -742,7 +742,8 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -742,7 +742,8 @@ 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(inode, NULL, 0, offset + 6, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset + 6,
sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -769,7 +770,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -769,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(inode, NULL, 0, offset, 4096 * 1024, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, 4096 * 1024, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -802,7 +803,7 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) ...@@ -802,7 +803,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(inode, NULL, 0, offset, sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, offset, sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -885,7 +886,7 @@ static int test_hole_first(u32 sectorsize, u32 nodesize) ...@@ -885,7 +886,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(inode, NULL, 0, 0, 2 * sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, 0, 2 * sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
goto out; goto out;
...@@ -907,7 +908,8 @@ static int test_hole_first(u32 sectorsize, u32 nodesize) ...@@ -907,7 +908,8 @@ static int test_hole_first(u32 sectorsize, u32 nodesize)
} }
free_extent_map(em); free_extent_map(em);
em = btrfs_get_extent(inode, NULL, 0, sectorsize, 2 * sectorsize, 0); em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, sectorsize,
2 * sectorsize, 0);
if (IS_ERR(em)) { if (IS_ERR(em)) {
test_msg("Got an error when we shouldn't have\n"); test_msg("Got an error when we shouldn't have\n");
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