All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 07/10] btrfs: Promote extent_read_full_page to btrfs_readpage
Date: Wed,  9 Sep 2020 12:49:11 +0300	[thread overview]
Message-ID: <20200909094914.29721-8-nborisov@suse.com> (raw)
In-Reply-To: <20200909094914.29721-1-nborisov@suse.com>

Now that btrfs_readpage is the only caller of extent_read_full_page the
latter can be opencoded in the former. Use the occassion to rename
__extent_read_full_page to extent_read_full_page. To facillitate this
change submit_one_bio has to be exported as well.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/extent_io.c | 21 ++++-----------------
 fs/btrfs/extent_io.h |  5 ++++-
 fs/btrfs/inode.c     |  9 ++++++++-
 3 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index d2b71e97218c..fa5717fe27f0 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -160,8 +160,8 @@ static int add_extent_changeset(struct extent_state *state, unsigned bits,
 	return ret;
 }
 
-static int __must_check submit_one_bio(struct bio *bio, int mirror_num,
-				       unsigned long bio_flags)
+int __must_check submit_one_bio(struct bio *bio, int mirror_num,
+				unsigned long bio_flags)
 {
 	blk_status_t ret = 0;
 	struct extent_io_tree *tree = bio->bi_private;
@@ -3367,9 +3367,8 @@ static inline void contiguous_readpages(struct page *pages[], int nr_pages,
 	}
 }
 
-static int __extent_read_full_page(struct page *page, struct bio **bio,
-				   int mirror_num, unsigned long *bio_flags,
-				   unsigned int read_flags)
+int extent_read_full_page(struct page *page, struct bio **bio, int mirror_num,
+			  unsigned long *bio_flags, unsigned int read_flags)
 {
 	struct btrfs_inode *inode = BTRFS_I(page->mapping->host);
 	u64 start = page_offset(page);
@@ -3383,18 +3382,6 @@ static int __extent_read_full_page(struct page *page, struct bio **bio,
 	return ret;
 }
 
-int extent_read_full_page(struct page *page)
-{
-	struct bio *bio = NULL;
-	unsigned long bio_flags = 0;
-	int ret;
-
-	ret = __extent_read_full_page(page, &bio, 0, &bio_flags, 0);
-	if (bio)
-		ret = submit_one_bio(bio, 0, bio_flags);
-	return ret;
-}
-
 static void update_nr_written(struct writeback_control *wbc,
 			      unsigned long nr_written)
 {
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 96bc9f0c2981..ff1895994994 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -193,7 +193,10 @@ 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 page *page);
+int __must_check submit_one_bio(struct bio *bio, int mirror_num,
+				unsigned long bio_flags);
+int extent_read_full_page(struct page *page, struct bio **bio, int mirror_num,
+			  unsigned long *bio_flags, unsigned int read_flags);
 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 3fd73573bbad..dcc8b5de1b9c 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8036,7 +8036,14 @@ static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 
 int btrfs_readpage(struct file *file, struct page *page)
 {
-	return extent_read_full_page(page);
+	struct bio *bio = NULL;
+	unsigned long bio_flags = 0;
+	int ret;
+
+	ret = extent_read_full_page(page, &bio, 0, &bio_flags, 0);
+	if (bio)
+		ret = submit_one_bio(bio, 0, bio_flags);
+	return ret;
 }
 
 static int btrfs_writepage(struct page *page, struct writeback_control *wbc)
-- 
2.17.1


  parent reply	other threads:[~2020-09-09  9:49 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09  9:49 [PATCH 00/10] Cleanup metadata page reading path Nikolay Borisov
2020-09-09  9:49 ` [PATCH 01/10] btrfs: Remove btree_readpage Nikolay Borisov
2020-09-09 10:37   ` Johannes Thumshirn
2020-09-09 11:13     ` Qu Wenruo
2020-09-09  9:49 ` [PATCH 02/10] btrfs: Remove pg_offset from btrfs_get_extent Nikolay Borisov
2020-09-09 10:40   ` Johannes Thumshirn
2020-09-09 11:15   ` Qu Wenruo
2020-09-09 20:46   ` kernel test robot
2020-09-09  9:49 ` [PATCH 03/10] btrfs: Simplify metadata pages reading Nikolay Borisov
2020-09-09 11:20   ` Qu Wenruo
2020-09-14  8:08     ` Nikolay Borisov
2020-09-14  8:22       ` Qu Wenruo
2020-09-10 14:56   ` Josef Bacik
2020-09-09  9:49 ` [PATCH 04/10] btrfs: Remove btree_get_extent Nikolay Borisov
2020-09-10 14:57   ` Josef Bacik
2020-09-09  9:49 ` [PATCH 05/10] btrfs: Remove btrfs_get_extent indirection from __do_readpage Nikolay Borisov
2020-09-09 11:24   ` Qu Wenruo
2020-09-09 11:56     ` Nikolay Borisov
2020-09-09  9:49 ` [PATCH 06/10] btrfs: Remove mirror_num argument from extent_read_full_page Nikolay Borisov
2020-09-10 14:58   ` Josef Bacik
2020-09-09  9:49 ` Nikolay Borisov [this message]
2020-09-10 15:01   ` [PATCH 07/10] btrfs: Promote extent_read_full_page to btrfs_readpage Josef Bacik
2020-09-09  9:49 ` [PATCH 08/10] btrfs: Sink mirror_num argument in extent_read_full_page Nikolay Borisov
2020-09-10 15:02   ` Josef Bacik
2020-09-09  9:49 ` [PATCH 09/10] btrfs: Sink read_flags argument into extent_read_full_page Nikolay Borisov
2020-09-10 15:03   ` Josef Bacik
2020-09-09  9:49 ` [PATCH 10/10] btrfs: Sink mirror_num argument in __do_readpage Nikolay Borisov
2020-09-10 15:04   ` Josef Bacik

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=20200909094914.29721-8-nborisov@suse.com \
    --to=nborisov@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.