summaryrefslogtreecommitdiffstats
path: root/mm/page_io.c
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2018-10-26 18:10:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-10-26 19:38:15 -0400
commitbc4ae27d817a4e92071ef67cb6368120cfabe7ec (patch)
treeaaa6b5b87cad72a3839ed10f9b06ea21030759dc /mm/page_io.c
parent91cbacc34512e37c9bb89125ca4b224ca6459245 (diff)
mm: split SWP_FILE into SWP_ACTIVATED and SWP_FS
The SWP_FILE flag serves two purposes: to make swap_{read,write}page() go through the filesystem, and to make swapoff() call ->swap_deactivate(). For Btrfs, we want the latter but not the former, so split this flag into two. This makes us always call ->swap_deactivate() if ->swap_activate() succeeded, not just if it didn't add any swap extents itself. This also resolves the issue of the very misleading name of SWP_FILE, which is only used for swap files over NFS. Link: http://lkml.kernel.org/r/6d63d8668c4287a4f6d203d65696e96f80abdfc7.1536704650.git.osandov@fb.com Signed-off-by: Omar Sandoval <osandov@fb.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: David Sterba <dsterba@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_io.c')
-rw-r--r--mm/page_io.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/page_io.c b/mm/page_io.c
index 573d3663d846..a451ffa9491c 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -283,7 +283,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
283 struct swap_info_struct *sis = page_swap_info(page); 283 struct swap_info_struct *sis = page_swap_info(page);
284 284
285 VM_BUG_ON_PAGE(!PageSwapCache(page), page); 285 VM_BUG_ON_PAGE(!PageSwapCache(page), page);
286 if (sis->flags & SWP_FILE) { 286 if (sis->flags & SWP_FS) {
287 struct kiocb kiocb; 287 struct kiocb kiocb;
288 struct file *swap_file = sis->swap_file; 288 struct file *swap_file = sis->swap_file;
289 struct address_space *mapping = swap_file->f_mapping; 289 struct address_space *mapping = swap_file->f_mapping;
@@ -365,7 +365,7 @@ int swap_readpage(struct page *page, bool synchronous)
365 goto out; 365 goto out;
366 } 366 }
367 367
368 if (sis->flags & SWP_FILE) { 368 if (sis->flags & SWP_FS) {
369 struct file *swap_file = sis->swap_file; 369 struct file *swap_file = sis->swap_file;
370 struct address_space *mapping = swap_file->f_mapping; 370 struct address_space *mapping = swap_file->f_mapping;
371 371
@@ -423,7 +423,7 @@ int swap_set_page_dirty(struct page *page)
423{ 423{
424 struct swap_info_struct *sis = page_swap_info(page); 424 struct swap_info_struct *sis = page_swap_info(page);
425 425
426 if (sis->flags & SWP_FILE) { 426 if (sis->flags & SWP_FS) {
427 struct address_space *mapping = sis->swap_file->f_mapping; 427 struct address_space *mapping = sis->swap_file->f_mapping;
428 428
429 VM_BUG_ON_PAGE(!PageSwapCache(page), page); 429 VM_BUG_ON_PAGE(!PageSwapCache(page), page);