From: jglisse@redhat.com
To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-block@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
"Jérôme Glisse" <jglisse@redhat.com>,
"Alexander Viro" <viro@zeniv.linux.org.uk>,
"Tejun Heo" <tj@kernel.org>, "Jan Kara" <jack@suse.cz>,
"Josef Bacik" <jbacik@fb.com>,
"Mel Gorman" <mgorman@techsingularity.net>,
"Jeff Layton" <jlayton@redhat.com>
Subject: [RFC PATCH 26/79] fs: add struct address_space to mpage_readpage() arguments
Date: Wed, 4 Apr 2018 15:18:00 -0400 [thread overview]
Message-ID: <20180404191831.5378-11-jglisse@redhat.com> (raw)
In-Reply-To: <20180404191831.5378-1-jglisse@redhat.com>
From: JA(C)rA'me Glisse <jglisse@redhat.com>
Add struct address_space to mpage_readpage(). Note this patch only add
arguments and modify call site conservatily using page->mapping and thus
the end result is as before this patch.
One step toward dropping reliance on page->mapping.
Signed-off-by: JA(C)rA'me Glisse <jglisse@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Josef Bacik <jbacik@fb.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Jeff Layton <jlayton@redhat.com>
---
fs/ext2/inode.c | 2 +-
fs/fat/inode.c | 2 +-
fs/gfs2/aops.c | 2 +-
fs/hpfs/file.c | 2 +-
fs/isofs/inode.c | 2 +-
fs/jfs/inode.c | 2 +-
fs/mpage.c | 14 ++++++++------
fs/nilfs2/inode.c | 2 +-
fs/qnx6/inode.c | 2 +-
fs/udf/inode.c | 2 +-
fs/xfs/xfs_aops.c | 2 +-
include/linux/mpage.h | 3 ++-
12 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 11b3c3e7ea65..33873c0a4c14 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -872,7 +872,7 @@ static int ext2_writepage(struct address_space *mapping, struct page *page,
static int ext2_readpage(struct file *file, struct address_space *mapping,
struct page *page)
{
- return mpage_readpage(page, ext2_get_block);
+ return mpage_readpage(page->mapping, page, ext2_get_block);
}
static int
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 4b70dcbcd192..9e6bc6364468 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -197,7 +197,7 @@ static int fat_writepages(struct address_space *mapping,
static int fat_readpage(struct file *file, struct address_space *mapping,
struct page *page)
{
- return mpage_readpage(page, fat_get_block);
+ return mpage_readpage(page->mapping, page, fat_get_block);
}
static int fat_readpages(struct file *file, struct address_space *mapping,
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index ff02313b86e6..b42775bba6a1 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -524,7 +524,7 @@ static int __gfs2_readpage(void *file, struct address_space *mapping,
error = stuffed_readpage(ip, page);
unlock_page(page);
} else {
- error = mpage_readpage(page, gfs2_block_map);
+ error = mpage_readpage(page->mapping, page, gfs2_block_map);
}
if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c
index 3f2cc3fcee80..620dd9709a2c 100644
--- a/fs/hpfs/file.c
+++ b/fs/hpfs/file.c
@@ -118,7 +118,7 @@ static int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_he
static int hpfs_readpage(struct file *file, struct address_space *mapping,
struct page *page)
{
- return mpage_readpage(page, hpfs_get_block);
+ return mpage_readpage(page->mapping, page, hpfs_get_block);
}
static int hpfs_writepage(struct address_space *mapping, struct page *page,
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 541d89e0621a..7d73b1036321 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1171,7 +1171,7 @@ struct buffer_head *isofs_bread(struct inode *inode, sector_t block)
static int isofs_readpage(struct file *file, struct address_space *mapping,
struct page *page)
{
- return mpage_readpage(page, isofs_get_block);
+ return mpage_readpage(page->mapping, page, isofs_get_block);
}
static int isofs_readpages(struct file *file, struct address_space *mapping,
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index be71214f4937..be6da161bc81 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -297,7 +297,7 @@ static int jfs_writepages(struct address_space *mapping,
static int jfs_readpage(struct file *file, struct address_space *mapping,
struct page *page)
{
- return mpage_readpage(page, jfs_get_block);
+ return mpage_readpage(page->mapping, page, jfs_get_block);
}
static int jfs_readpages(struct file *file, struct address_space *mapping,
diff --git a/fs/mpage.c b/fs/mpage.c
index 8800bcde5f4e..52a6028e2066 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -143,12 +143,13 @@ map_buffer_to_page(struct inode *inode, struct page *page,
* get_block() call.
*/
static struct bio *
-do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages,
+do_mpage_readpage(struct bio *bio, struct address_space *mapping,
+ struct page *page, unsigned nr_pages,
sector_t *last_block_in_bio, struct buffer_head *map_bh,
unsigned long *first_logical_block, get_block_t get_block,
gfp_t gfp)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = mapping->host;
const unsigned blkbits = inode->i_blkbits;
const unsigned blocks_per_page = PAGE_SIZE >> blkbits;
const unsigned blocksize = 1 << blkbits;
@@ -381,7 +382,7 @@ mpage_readpages(struct address_space *mapping, struct list_head *pages,
if (!add_to_page_cache_lru(page, mapping,
page->index,
gfp)) {
- bio = do_mpage_readpage(bio, page,
+ bio = do_mpage_readpage(bio, mapping, page,
nr_pages - page_idx,
&last_block_in_bio, &map_bh,
&first_logical_block,
@@ -399,17 +400,18 @@ EXPORT_SYMBOL(mpage_readpages);
/*
* This isn't called much at all
*/
-int mpage_readpage(struct page *page, get_block_t get_block)
+int mpage_readpage(struct address_space *mapping, struct page *page,
+ get_block_t get_block)
{
struct bio *bio = NULL;
sector_t last_block_in_bio = 0;
struct buffer_head map_bh;
unsigned long first_logical_block = 0;
- gfp_t gfp = mapping_gfp_constraint(page->mapping, GFP_KERNEL);
+ gfp_t gfp = mapping_gfp_constraint(mapping, GFP_KERNEL);
map_bh.b_state = 0;
map_bh.b_size = 0;
- bio = do_mpage_readpage(bio, page, 1, &last_block_in_bio,
+ bio = do_mpage_readpage(bio, mapping, page, 1, &last_block_in_bio,
&map_bh, &first_logical_block, get_block, gfp);
if (bio)
mpage_bio_submit(REQ_OP_READ, 0, bio);
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index 86d12a7822a9..7cc0268d68ce 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -152,7 +152,7 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff,
static int nilfs_readpage(struct file *file, struct address_space *mapping,
struct page *page)
{
- return mpage_readpage(page, nilfs_get_block);
+ return mpage_readpage(page->mapping, page, nilfs_get_block);
}
/**
diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c
index 98cb4671405e..c7f3623fd5f4 100644
--- a/fs/qnx6/inode.c
+++ b/fs/qnx6/inode.c
@@ -96,7 +96,7 @@ static int qnx6_check_blockptr(__fs32 ptr)
static int qnx6_readpage(struct file *file, struct address_space *mapping,
struct page *page)
{
- return mpage_readpage(page, qnx6_get_block);
+ return mpage_readpage(page->mapping, page, qnx6_get_block);
}
static int qnx6_readpages(struct file *file, struct address_space *mapping,
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 63264d72999a..56cf8e70d298 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -188,7 +188,7 @@ static int udf_writepages(struct address_space *mapping,
static int udf_readpage(struct file *file, struct address_space *mapping,
struct page *page)
{
- return mpage_readpage(page, udf_get_block);
+ return mpage_readpage(page->mapping, page, udf_get_block);
}
static int udf_readpages(struct file *file, struct address_space *mapping,
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 00922a82ede6..bed27e59720a 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -1415,7 +1415,7 @@ xfs_vm_readpage(
struct page *page)
{
trace_xfs_vm_readpage(page->mapping->host, 1);
- return mpage_readpage(page, xfs_get_blocks);
+ return mpage_readpage(page->mapping, page, xfs_get_blocks);
}
STATIC int
diff --git a/include/linux/mpage.h b/include/linux/mpage.h
index e7f489fc090c..1708caae2640 100644
--- a/include/linux/mpage.h
+++ b/include/linux/mpage.h
@@ -16,7 +16,8 @@ struct writeback_control;
int mpage_readpages(struct address_space *mapping, struct list_head *pages,
unsigned nr_pages, get_block_t get_block);
-int mpage_readpage(struct page *page, get_block_t get_block);
+int mpage_readpage(struct address_space *mapping, struct page *page,
+ get_block_t get_block);
int mpage_writepages(struct address_space *mapping,
struct writeback_control *wbc, get_block_t get_block);
int mpage_writepage(struct address_space *mapping, struct page *page,
--
2.14.3
next prev parent reply other threads:[~2018-04-04 19:19 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-04 19:17 [RFC PATCH 00/79] Generic page write protection and a solution to page waitqueue jglisse
2018-04-04 19:17 ` [RFC PATCH 04/79] pipe: add inode field to struct pipe_inode_info jglisse
2018-04-04 19:17 ` [RFC PATCH 05/79] mm/swap: add an helper to get address_space from swap_entry_t jglisse
2018-04-04 19:17 ` [RFC PATCH 06/79] mm/page: add helpers to dereference struct page index field jglisse
2018-04-04 19:17 ` [RFC PATCH 07/79] mm/page: add helpers to find mapping give a page and buffer head jglisse
2018-04-04 19:17 ` [RFC PATCH 08/79] mm/page: add helpers to find page mapping and private given a bio jglisse
2018-04-04 19:17 ` [RFC PATCH 09/79] fs: add struct address_space to read_cache_page() callback argument jglisse
2018-04-04 19:17 ` [RFC PATCH 20/79] fs: add struct address_space to write_cache_pages() " jglisse
2018-04-04 19:17 ` [RFC PATCH 22/79] fs: add struct inode to block_read_full_page() arguments jglisse
2018-04-04 19:17 ` [RFC PATCH 24/79] fs: add struct inode to nobh_writepage() arguments jglisse
2018-04-04 19:18 ` jglisse [this message]
2018-04-04 19:18 ` [RFC PATCH 27/79] fs: add struct address_space to fscache_read*() callback arguments jglisse
2018-04-04 19:18 ` [RFC PATCH 28/79] fs: introduce page_is_truncated() helper jglisse
2018-04-04 19:18 ` [RFC PATCH 29/79] fs/block: add struct address_space to bdev_write_page() arguments jglisse
2018-04-04 19:18 ` [RFC PATCH 30/79] fs/block: add struct address_space to __block_write_begin() arguments jglisse
2018-04-04 19:18 ` [RFC PATCH 31/79] fs/block: add struct address_space to __block_write_begin_int() args jglisse
2018-04-04 19:18 ` [RFC PATCH 32/79] fs/block: do not rely on page->mapping get it from the context jglisse
2018-04-04 19:18 ` [RFC PATCH 33/79] fs/journal: add struct super_block to jbd2_journal_forget() arguments jglisse
2018-04-04 19:18 ` [RFC PATCH 34/79] fs/journal: add struct inode to jbd2_journal_revoke() arguments jglisse
2018-04-04 19:18 ` [RFC PATCH 35/79] fs/buffer: add struct address_space and struct page to end_io callback jglisse
2018-04-04 19:18 ` [RFC PATCH 36/79] fs/buffer: add struct super_block to bforget() arguments jglisse
2018-04-04 19:18 ` [RFC PATCH 37/79] fs/buffer: add struct super_block to __bforget() arguments jglisse
2018-04-04 19:18 ` [RFC PATCH 38/79] fs/buffer: add first buffer flag for first buffer_head in a page jglisse
2018-04-04 19:18 ` [RFC PATCH 39/79] fs/buffer: add struct address_space to clean_page_buffers() arguments jglisse
2018-04-04 19:18 ` [RFC PATCH 50/79] fs: stop relying on mapping field of struct page, get it from context jglisse
2018-04-04 19:18 ` [RFC PATCH 51/79] " jglisse
2018-04-04 19:18 ` [RFC PATCH 52/79] fs/buffer: use _page_has_buffers() instead of page_has_buffers() jglisse
2018-04-04 19:18 ` [RFC PATCH 63/79] mm/page: convert page's index lookup to be against specific mapping jglisse
2018-04-04 19:18 ` [RFC PATCH 64/79] mm/buffer: use _page_has_buffers() instead of page_has_buffers() jglisse
2018-04-04 19:18 ` [RFC PATCH 65/79] mm/swap: add struct swap_info_struct swap_readpage() arguments jglisse
2018-04-04 19:18 ` [RFC PATCH 68/79] mm/vma_address: convert page's index lookup to be against specific mapping jglisse
2018-04-04 19:18 ` [RFC PATCH 69/79] fs/journal: add struct address_space to jbd2_journal_try_to_free_buffers() arguments jglisse
2018-04-04 19:18 ` [RFC PATCH 70/79] mm: add struct address_space to mark_buffer_dirty() jglisse
2018-04-04 19:18 ` [RFC PATCH 71/79] mm: add struct address_space to set_page_dirty() jglisse
2018-04-04 19:18 ` [RFC PATCH 72/79] mm: add struct address_space to set_page_dirty_lock() jglisse
2018-04-04 19:18 ` [RFC PATCH 73/79] mm: pass down struct address_space to set_page_dirty() jglisse
2018-04-04 19:18 ` [RFC PATCH 74/79] mm/page_ronly: add config option for generic read only page framework jglisse
2018-04-04 19:18 ` [RFC PATCH 75/79] mm/page_ronly: add page read only core structure and helpers jglisse
2018-04-04 19:18 ` [RFC PATCH 76/79] mm/ksm: have ksm select PAGE_RONLY config jglisse
2018-04-04 19:18 ` [RFC PATCH 77/79] mm/ksm: hide set_page_stable_node() and page_stable_node() jglisse
2018-04-04 19:18 ` [RFC PATCH 78/79] mm/ksm: rename PAGE_MAPPING_KSM to PAGE_MAPPING_RONLY jglisse
2018-04-04 19:18 ` [RFC PATCH 79/79] mm/ksm: set page->mapping to page_ronly struct instead of stable_node jglisse
2018-04-18 14:13 ` [RFC PATCH 00/79] Generic page write protection and a solution to page waitqueue Jan Kara
2018-04-18 15:54 ` Jerome Glisse
2018-04-18 16:20 ` Darrick J. Wong
2018-04-19 10:32 ` Jan Kara
2018-04-19 14:52 ` Jerome Glisse
2018-04-20 19:57 ` Tim Chen
2018-04-20 22:19 ` Jerome Glisse
2018-04-20 23:48 ` Tim Chen
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=20180404191831.5378-11-jglisse@redhat.com \
--to=jglisse@redhat.com \
--cc=jack@suse.cz \
--cc=jbacik@fb.com \
--cc=jlayton@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=tj@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).