Skip to content

Commit

Permalink
btrfs: remove btree_get_extent
Browse files Browse the repository at this point in the history
The sole purpose of this function was to satisfy the requirements of
__do_readpage. Since that function is no longer used to read metadata
pages the need to keep btree_get_extent around has also disappeared.
Simply remove it.

Reviewed-by: Josef Bacik <[email protected]>
Reviewed-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Nikolay Borisov <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
lorddoskias authored and kdave committed Oct 7, 2020
1 parent 0420177 commit 208d634
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
47 changes: 0 additions & 47 deletions fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,53 +204,6 @@ void btrfs_set_buffer_lockdep_class(u64 objectid, struct extent_buffer *eb,

#endif

/*
* extents on the btree inode are pretty simple, there's one extent
* that covers the entire device
*/
struct extent_map *btree_get_extent(struct btrfs_inode *inode,
struct page *page, size_t pg_offset,
u64 start, u64 len)
{
struct extent_map_tree *em_tree = &inode->extent_tree;
struct extent_map *em;
int ret;

read_lock(&em_tree->lock);
em = lookup_extent_mapping(em_tree, start, len);
if (em) {
read_unlock(&em_tree->lock);
goto out;
}
read_unlock(&em_tree->lock);

em = alloc_extent_map();
if (!em) {
em = ERR_PTR(-ENOMEM);
goto out;
}
em->start = 0;
em->len = (u64)-1;
em->block_len = (u64)-1;
em->block_start = 0;

write_lock(&em_tree->lock);
ret = add_extent_mapping(em_tree, em, 0);
if (ret == -EEXIST) {
free_extent_map(em);
em = lookup_extent_mapping(em_tree, start, len);
if (!em)
em = ERR_PTR(-EIO);
} else if (ret) {
free_extent_map(em);
em = ERR_PTR(ret);
}
write_unlock(&em_tree->lock);

out:
return em;
}

/*
* Compute the csum of a btree block and store the result to provided buffer.
*/
Expand Down
3 changes: 0 additions & 3 deletions fs/btrfs/disk-io.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
u64 objectid);
int btree_lock_page_hook(struct page *page, void *data,
void (*flush_fn)(void *));
struct extent_map *btree_get_extent(struct btrfs_inode *inode,
struct page *page, size_t pg_offset,
u64 start, u64 len);
int btrfs_get_num_tolerated_disk_barrier_failures(u64 flags);
int __init btrfs_end_io_wq_init(void);
void __cold btrfs_end_io_wq_exit(void);
Expand Down

0 comments on commit 208d634

Please sign in to comment.