From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-f67.google.com ([209.85.160.67]:44300 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968137AbeE2WRo (ORCPT ); Tue, 29 May 2018 18:17:44 -0400 Received: by mail-pl0-f67.google.com with SMTP id z9-v6so6423403plk.11 for ; Tue, 29 May 2018 15:17:44 -0700 (PDT) From: Jens Axboe To: linux-fsdevel@vger.kernel.org Cc: viro@zeniv.linux.org.uk, akpm@linux-foundation.org, Jens Axboe Subject: [PATCH 4/4] ext4: readpages() should submit IO as read-ahead Date: Tue, 29 May 2018 16:17:27 -0600 Message-Id: <1527632247-23350-5-git-send-email-axboe@kernel.dk> In-Reply-To: <1527632247-23350-1-git-send-email-axboe@kernel.dk> References: <1527632247-23350-1-git-send-email-axboe@kernel.dk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 --- 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