Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 1/8] btrfs: remove extent_page_data::tree
Date: Wed,  5 Feb 2020 19:09:26 +0100	[thread overview]
Message-ID: <9bca78d5ecd1eec04ebaa6fa760af3817f9345ab.1580925977.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1580925977.git.dsterba@suse.com>

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.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/extent_io.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index d91a48d73e8f..753fc92ad348 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -122,7 +122,6 @@ struct tree_entry {
 
 struct extent_page_data {
 	struct bio *bio;
-	struct extent_io_tree *tree;
 	/* tells writepage not to lock the state bits for this range
 	 * it still does the unlocking
 	 */
@@ -2967,6 +2966,7 @@ static int submit_extent_page(unsigned int opf, struct extent_io_tree *tree,
 	sector_t sector = offset >> 9;
 
 	ASSERT(bio_ret);
+	ASSERT(tree == &BTRFS_I(page->mapping->host)->io_tree);
 
 	if (*bio_ret) {
 		bool contig;
@@ -3434,7 +3434,7 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
 				 unsigned long nr_written,
 				 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 page_end = start + PAGE_SIZE - 1;
 	u64 end;
@@ -3908,11 +3908,9 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb,
 int btree_write_cache_pages(struct address_space *mapping,
 				   struct writeback_control *wbc)
 {
-	struct extent_io_tree *tree = &BTRFS_I(mapping->host)->io_tree;
 	struct extent_buffer *eb, *prev_eb = NULL;
 	struct extent_page_data epd = {
 		.bio = NULL,
-		.tree = tree,
 		.extent_locked = 0,
 		.sync_io = wbc->sync_mode == WB_SYNC_ALL,
 	};
@@ -4201,7 +4199,6 @@ int extent_write_full_page(struct page *page, struct writeback_control *wbc)
 	int ret;
 	struct extent_page_data epd = {
 		.bio = NULL,
-		.tree = &BTRFS_I(page->mapping->host)->io_tree,
 		.extent_locked = 0,
 		.sync_io = wbc->sync_mode == WB_SYNC_ALL,
 	};
@@ -4223,14 +4220,12 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end,
 {
 	int ret = 0;
 	struct address_space *mapping = inode->i_mapping;
-	struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree;
 	struct page *page;
 	unsigned long nr_pages = (end - start + PAGE_SIZE) >>
 		PAGE_SHIFT;
 
 	struct extent_page_data epd = {
 		.bio = NULL,
-		.tree = tree,
 		.extent_locked = 1,
 		.sync_io = mode == WB_SYNC_ALL,
 	};
@@ -4274,7 +4269,6 @@ int extent_writepages(struct address_space *mapping,
 	int ret = 0;
 	struct extent_page_data epd = {
 		.bio = NULL,
-		.tree = &BTRFS_I(mapping->host)->io_tree,
 		.extent_locked = 0,
 		.sync_io = wbc->sync_mode == WB_SYNC_ALL,
 	};
-- 
2.25.0


  reply	other threads:[~2020-02-05 18:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05 18:09 [PATCH 0/8] Cleanup io_tree arguments in extent read/write path David Sterba
2020-02-05 18:09 ` David Sterba [this message]
2020-02-06  8:34   ` [PATCH 1/8] btrfs: remove extent_page_data::tree Anand Jain
2020-02-06 13:32   ` Johannes Thumshirn
2020-02-05 18:09 ` [PATCH 2/8] btrfs: drop argument tree from submit_extent_page David Sterba
2020-02-06  5:58   ` Anand Jain
2020-02-06 13:47     ` David Sterba
2020-02-11  5:00       ` Anand Jain
2020-02-06 13:33   ` Johannes Thumshirn
2020-02-05 18:09 ` [PATCH 3/8] btrfs: add assertions for tree == inode->io_tree to extent IO helpers David Sterba
2020-02-06 13:34   ` Johannes Thumshirn
2020-02-05 18:09 ` [PATCH 4/8] btrfs: drop argument tree from btrfs_lock_and_flush_ordered_range David Sterba
2020-02-06 13:38   ` Johannes Thumshirn
2020-02-05 18:09 ` [PATCH 5/8] btrfs: sink argument tree to extent_read_full_page David Sterba
2020-02-06 13:40   ` Johannes Thumshirn
2020-02-05 18:09 ` [PATCH 6/8] btrfs: sink argument tree to __extent_read_full_page David Sterba
2020-02-06 13:40   ` Johannes Thumshirn
2020-02-05 18:09 ` [PATCH 7/8] btrfs: sink arugment tree to contiguous_readpages David Sterba
2020-02-06 13:42   ` Johannes Thumshirn
2020-02-05 18:09 ` [PATCH 8/8] btrfs: sink argument tree to __do_readpage David Sterba
2020-02-06 13:43   ` Johannes Thumshirn
2020-02-06 13:24 ` [PATCH 0/8] Cleanup io_tree arguments in extent read/write path Nikolay Borisov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9bca78d5ecd1eec04ebaa6fa760af3817f9345ab.1580925977.git.dsterba@suse.com \
    --to=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox