summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérôme Glisse <jglisse@redhat.com>2018-03-25 20:35:30 -0400
committerJérôme Glisse <jglisse@redhat.com>2018-04-04 14:37:19 -0400
commit4264b633246c03d4778753724e313a71aa6624f9 (patch)
tree43aec3e87b31dc6d72fcc535b279d9a58a29c3e4
parent420bbfc02b31c438a94e22f6232803b1e9468b35 (diff)
mm/swap: add struct address_space to __swap_writepage() arguments
Add struct address_space to __swap_writepage() arguments. One step toward dropping reliance on page->private during swap read back. Signed-off-by: Jérôme Glisse <jglisse@redhat.com> Cc: Seth Jennings <sjenning@redhat.com> Cc: Dan Streetman <ddstreet@ieee.org> Cc: linux-mm@kvack.org CC: Andrew Morton <akpm@linux-foundation.org> 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>
-rw-r--r--include/linux/swap.h4
-rw-r--r--mm/page_io.c9
-rw-r--r--mm/zswap.c4
3 files changed, 10 insertions, 7 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 90c26ec2997c..e4337e531052 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -388,8 +388,8 @@ extern int swap_readpage(struct swap_info_struct *sis, struct page *page,
extern int swap_writepage(struct address_space *mapping, struct page *page,
struct writeback_control *wbc);
extern void end_swap_bio_write(struct bio *bio);
-extern int __swap_writepage(struct page *page, struct writeback_control *wbc,
- bio_end_io_t end_write_func);
+extern int __swap_writepage(struct address_space *mapping, struct page *page,
+ struct writeback_control *wbc, bio_end_io_t end_write_func);
extern int swap_set_page_dirty(struct address_space *mapping,
struct page *page);
diff --git a/mm/page_io.c b/mm/page_io.c
index f4e05c90c87e..670d8aa240dc 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -257,7 +257,7 @@ int swap_writepage(struct address_space *mapping, struct page *page,
end_page_writeback(page);
goto out;
}
- ret = __swap_writepage(page, wbc, end_swap_bio_write);
+ ret = __swap_writepage(mapping, page, wbc, end_swap_bio_write);
out:
return ret;
}
@@ -276,14 +276,15 @@ static inline void count_swpout_vm_event(struct page *page)
count_vm_events(PSWPOUT, hpage_nr_pages(page));
}
-int __swap_writepage(struct page *page, struct writeback_control *wbc,
- bio_end_io_t end_write_func)
+int __swap_writepage(struct address_space *mapping, struct page *page,
+ struct writeback_control *wbc, bio_end_io_t end_write_func)
{
struct bio *bio;
int ret;
struct swap_info_struct *sis = page_swap_info(page);
struct file *swap_file = sis->swap_file;
- struct address_space *mapping = swap_file->f_mapping;
+
+ mapping = swap_file->f_mapping;
VM_BUG_ON_PAGE(!PageSwapCache(page), page);
if (sis->flags & SWP_FILE) {
diff --git a/mm/zswap.c b/mm/zswap.c
index 61a5c41972db..48b7d1c4d7ea 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -861,6 +861,7 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)
struct writeback_control wbc = {
.sync_mode = WB_SYNC_NONE,
};
+ struct address_space *mapping;
/* extract swpentry from data */
zhdr = zpool_map_handle(pool, handle, ZPOOL_MM_RO);
@@ -868,6 +869,7 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)
zpool_unmap_handle(pool, handle);
tree = zswap_trees[swp_type(swpentry)];
offset = swp_offset(swpentry);
+ mapping = swap_address_space(swpentry);
/* find and ref zswap entry */
spin_lock(&tree->lock);
@@ -915,7 +917,7 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)
SetPageReclaim(page);
/* start writeback */
- __swap_writepage(page, &wbc, end_swap_bio_write);
+ __swap_writepage(mapping, page, &wbc, end_swap_bio_write);
put_page(page);
zswap_written_back_pages++;