linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: linux-fsdevel@vger.kernel.org
Cc: viro@zeniv.linux.org.uk, akpm@linux-foundation.org,
	Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 4/4] ext4: readpages() should submit IO as read-ahead
Date: Wed, 30 May 2018 08:42:09 -0600	[thread overview]
Message-ID: <1527691329-2371-5-git-send-email-axboe@kernel.dk> (raw)
In-Reply-To: <1527691329-2371-1-git-send-email-axboe@kernel.dk>

a_ops->readpages() is only ever used for read-ahead. Ensure that we
pass this information down to the block layer.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 fs/ext4/ext4.h     | 2 +-
 fs/ext4/inode.c    | 5 +++--
 fs/ext4/readpage.c | 5 +++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index a42e71203e53..62df0322b567 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -3052,7 +3052,7 @@ static inline void ext4_set_de_type(struct super_block *sb,
 /* readpages.c */
 extern int ext4_mpage_readpages(struct address_space *mapping,
 				struct list_head *pages, struct page *page,
-				unsigned nr_pages);
+				unsigned nr_pages, bool is_readahead);
 
 /* symlink.c */
 extern const struct inode_operations ext4_encrypted_symlink_inode_operations;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 1e50c5efae67..2bb50d184bf5 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3327,7 +3327,8 @@ static int ext4_readpage(struct file *file, struct page *page)
 		ret = ext4_readpage_inline(inode, page);
 
 	if (ret == -EAGAIN)
-		return ext4_mpage_readpages(page->mapping, NULL, page, 1);
+		return ext4_mpage_readpages(page->mapping, NULL, page, 1,
+						false);
 
 	return ret;
 }
@@ -3342,7 +3343,7 @@ ext4_readpages(struct file *file, struct address_space *mapping,
 	if (ext4_has_inline_data(inode))
 		return 0;
 
-	return ext4_mpage_readpages(mapping, pages, NULL, nr_pages);
+	return ext4_mpage_readpages(mapping, pages, NULL, nr_pages, true);
 }
 
 static void ext4_invalidatepage(struct page *page, unsigned int offset,
diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c
index 9ffa6fad18db..28c857d3b309 100644
--- a/fs/ext4/readpage.c
+++ b/fs/ext4/readpage.c
@@ -98,7 +98,7 @@ static void mpage_end_io(struct bio *bio)
 
 int ext4_mpage_readpages(struct address_space *mapping,
 			 struct list_head *pages, struct page *page,
-			 unsigned nr_pages)
+			 unsigned nr_pages, bool is_readahead)
 {
 	struct bio *bio = NULL;
 	sector_t last_block_in_bio = 0;
@@ -259,7 +259,8 @@ int ext4_mpage_readpages(struct address_space *mapping,
 			bio->bi_iter.bi_sector = blocks[0] << (blkbits - 9);
 			bio->bi_end_io = mpage_end_io;
 			bio->bi_private = ctx;
-			bio_set_op_attrs(bio, REQ_OP_READ, 0);
+			bio_set_op_attrs(bio, REQ_OP_READ,
+						is_readahead ? REQ_RAHEAD : 0);
 		}
 
 		length = first_hole << blkbits;
-- 
2.7.4

  parent reply	other threads:[~2018-05-30 14:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-30 14:42 [PATCHSET v3 0/4] Submit ->readpages() IO as read-ahead Jens Axboe
2018-05-30 14:42 ` [PATCH 1/4] mpage: add argument structure for do_mpage_readpage() Jens Axboe
2018-05-30 14:42 ` [PATCH 2/4] mpage: mpage_readpages() should submit IO as read-ahead Jens Axboe
2018-05-30 14:42 ` [PATCH 3/4] btrfs: readpages() " Jens Axboe
2018-05-30 14:42 ` Jens Axboe [this message]
2018-06-19 23:56 ` [PATCHSET v3 0/4] Submit ->readpages() " Andrew Morton
2018-06-20 14:07   ` Jens Axboe
2018-06-20 19:58     ` Andrew Morton
2018-06-20 20:15       ` Chris Mason
2018-06-20 22:28       ` Jens Axboe
2018-06-20 23:23         ` Andrew Morton
2018-06-20 23:33           ` Jens Axboe
2018-06-20 23:45             ` Andrew Morton
2018-06-21  0:06               ` Jens Axboe
2018-06-21 12:21         ` Christoph Hellwig
2018-06-21 13:52           ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2018-06-21  1:07 [PATCH v4 " Jens Axboe
2018-06-21  1:07 ` [PATCH 4/4] ext4: readpages() should submit " Jens Axboe
2018-05-29 22:17 [PATCHSET v2 0/4] Submit ->readpages() " Jens Axboe
2018-05-29 22:17 ` [PATCH 4/4] ext4: readpages() should submit " Jens Axboe

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=1527691329-2371-5-git-send-email-axboe@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).