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 5/8] btrfs: sink argument tree to extent_read_full_page
Date: Wed,  5 Feb 2020 19:09:35 +0100	[thread overview]
Message-ID: <fb262a910895eaa84572cd94b6f412215b2967e6.1580925977.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1580925977.git.dsterba@suse.com>

The tree pointer can be safely read from the page's inode, use it and
drop the redundant argument.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/disk-io.c   | 4 +---
 fs/btrfs/extent_io.c | 7 +++----
 fs/btrfs/extent_io.h | 4 ++--
 fs/btrfs/inode.c     | 4 +---
 4 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 28622de9e642..a1e5b9511993 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -972,9 +972,7 @@ static int btree_writepages(struct address_space *mapping,
 
 static int btree_readpage(struct file *file, struct page *page)
 {
-	struct extent_io_tree *tree;
-	tree = &BTRFS_I(page->mapping->host)->io_tree;
-	return extent_read_full_page(tree, page, btree_get_extent, 0);
+	return extent_read_full_page(page, btree_get_extent, 0);
 }
 
 static int btree_releasepage(struct page *page, gfp_t gfp_flags)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index a0a80a151085..97e613e72ed4 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3324,15 +3324,14 @@ static int __extent_read_full_page(struct extent_io_tree *tree,
 	return ret;
 }
 
-int extent_read_full_page(struct extent_io_tree *tree, struct page *page,
-			    get_extent_t *get_extent, int mirror_num)
+int extent_read_full_page(struct page *page, get_extent_t *get_extent,
+			  int mirror_num)
 {
 	struct bio *bio = NULL;
 	unsigned long bio_flags = 0;
+	struct extent_io_tree *tree = &BTRFS_I(page->mapping->host)->io_tree;
 	int ret;
 
-	ASSERT(tree == &BTRFS_I(page->mapping->host)->io_tree);
-
 	ret = __extent_read_full_page(tree, page, get_extent, &bio, mirror_num,
 				      &bio_flags, 0);
 	if (bio)
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 5d205bbaafdc..234622101230 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -189,8 +189,8 @@ typedef struct extent_map *(get_extent_t)(struct btrfs_inode *inode,
 int try_release_extent_mapping(struct page *page, gfp_t mask);
 int try_release_extent_buffer(struct page *page);
 
-int extent_read_full_page(struct extent_io_tree *tree, struct page *page,
-			  get_extent_t *get_extent, int mirror_num);
+int extent_read_full_page(struct page *page, get_extent_t *get_extent,
+			  int mirror_num);
 int extent_write_full_page(struct page *page, struct writeback_control *wbc);
 int extent_write_locked_range(struct inode *inode, u64 start, u64 end,
 			      int mode);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 29b06c109137..64e3c62cc0df 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8256,9 +8256,7 @@ static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 
 int btrfs_readpage(struct file *file, struct page *page)
 {
-	struct extent_io_tree *tree;
-	tree = &BTRFS_I(page->mapping->host)->io_tree;
-	return extent_read_full_page(tree, page, btrfs_get_extent, 0);
+	return extent_read_full_page(page, btrfs_get_extent, 0);
 }
 
 static int btrfs_writepage(struct page *page, struct writeback_control *wbc)
-- 
2.25.0


  parent 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 ` [PATCH 1/8] btrfs: remove extent_page_data::tree David Sterba
2020-02-06  8:34   ` 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 ` David Sterba [this message]
2020-02-06 13:40   ` [PATCH 5/8] btrfs: sink argument tree to extent_read_full_page 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=fb262a910895eaa84572cd94b6f412215b2967e6.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