Commit 45b08405 authored by David Sterba's avatar David Sterba

btrfs: remove extent_page_data::tree

All functions that set up extent_page_data::tree set it to the inode
io_tree. That's passed down the callstack that accesses either the same
inode or its pages. In the end submit_extent_page can pull the tree out
of the page and we don't have to store it in the structure.
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent bf31f87f
...@@ -122,7 +122,6 @@ struct tree_entry { ...@@ -122,7 +122,6 @@ struct tree_entry {
struct extent_page_data { struct extent_page_data {
struct bio *bio; struct bio *bio;
struct extent_io_tree *tree;
/* tells writepage not to lock the state bits for this range /* tells writepage not to lock the state bits for this range
* it still does the unlocking * it still does the unlocking
*/ */
...@@ -3004,6 +3003,7 @@ static int submit_extent_page(unsigned int opf, struct extent_io_tree *tree, ...@@ -3004,6 +3003,7 @@ static int submit_extent_page(unsigned int opf, struct extent_io_tree *tree,
sector_t sector = offset >> 9; sector_t sector = offset >> 9;
ASSERT(bio_ret); ASSERT(bio_ret);
ASSERT(tree == &BTRFS_I(page->mapping->host)->io_tree);
if (*bio_ret) { if (*bio_ret) {
bool contig; bool contig;
...@@ -3471,7 +3471,7 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode, ...@@ -3471,7 +3471,7 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
unsigned long nr_written, unsigned long nr_written,
int *nr_ret) int *nr_ret)
{ {
struct extent_io_tree *tree = epd->tree; struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree;
u64 start = page_offset(page); u64 start = page_offset(page);
u64 page_end = start + PAGE_SIZE - 1; u64 page_end = start + PAGE_SIZE - 1;
u64 end; u64 end;
...@@ -3945,11 +3945,9 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb, ...@@ -3945,11 +3945,9 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb,
int btree_write_cache_pages(struct address_space *mapping, int btree_write_cache_pages(struct address_space *mapping,
struct writeback_control *wbc) struct writeback_control *wbc)
{ {
struct extent_io_tree *tree = &BTRFS_I(mapping->host)->io_tree;
struct extent_buffer *eb, *prev_eb = NULL; struct extent_buffer *eb, *prev_eb = NULL;
struct extent_page_data epd = { struct extent_page_data epd = {
.bio = NULL, .bio = NULL,
.tree = tree,
.extent_locked = 0, .extent_locked = 0,
.sync_io = wbc->sync_mode == WB_SYNC_ALL, .sync_io = wbc->sync_mode == WB_SYNC_ALL,
}; };
...@@ -4238,7 +4236,6 @@ int extent_write_full_page(struct page *page, struct writeback_control *wbc) ...@@ -4238,7 +4236,6 @@ int extent_write_full_page(struct page *page, struct writeback_control *wbc)
int ret; int ret;
struct extent_page_data epd = { struct extent_page_data epd = {
.bio = NULL, .bio = NULL,
.tree = &BTRFS_I(page->mapping->host)->io_tree,
.extent_locked = 0, .extent_locked = 0,
.sync_io = wbc->sync_mode == WB_SYNC_ALL, .sync_io = wbc->sync_mode == WB_SYNC_ALL,
}; };
...@@ -4260,14 +4257,12 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end, ...@@ -4260,14 +4257,12 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end,
{ {
int ret = 0; int ret = 0;
struct address_space *mapping = inode->i_mapping; struct address_space *mapping = inode->i_mapping;
struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree;
struct page *page; struct page *page;
unsigned long nr_pages = (end - start + PAGE_SIZE) >> unsigned long nr_pages = (end - start + PAGE_SIZE) >>
PAGE_SHIFT; PAGE_SHIFT;
struct extent_page_data epd = { struct extent_page_data epd = {
.bio = NULL, .bio = NULL,
.tree = tree,
.extent_locked = 1, .extent_locked = 1,
.sync_io = mode == WB_SYNC_ALL, .sync_io = mode == WB_SYNC_ALL,
}; };
...@@ -4311,7 +4306,6 @@ int extent_writepages(struct address_space *mapping, ...@@ -4311,7 +4306,6 @@ int extent_writepages(struct address_space *mapping,
int ret = 0; int ret = 0;
struct extent_page_data epd = { struct extent_page_data epd = {
.bio = NULL, .bio = NULL,
.tree = &BTRFS_I(mapping->host)->io_tree,
.extent_locked = 0, .extent_locked = 0,
.sync_io = wbc->sync_mode == WB_SYNC_ALL, .sync_io = wbc->sync_mode == WB_SYNC_ALL,
}; };
......
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