---

 25-akpm/include/linux/swap.h |    5 +++--
 25-akpm/mm/filemap.c         |    2 +-
 25-akpm/mm/nommu.c           |    5 +++++
 25-akpm/mm/swap_state.c      |    4 ++--
 25-akpm/mm/swapfile.c        |   23 ++++++++---------------
 5 files changed, 19 insertions(+), 20 deletions(-)

diff -puN include/linux/swap.h~rmap-5-swap_unplug-page-revert include/linux/swap.h
--- 25/include/linux/swap.h~rmap-5-swap_unplug-page-revert	2004-05-12 19:33:14.539139016 -0700
+++ 25-akpm/include/linux/swap.h	2004-05-12 19:52:39.578026184 -0700
@@ -181,6 +181,8 @@ extern int vm_swappiness;
 extern int shmem_unuse(swp_entry_t entry, struct page *page);
 #endif /* CONFIG_MMU */
 
+extern void swap_unplug_io_fn(struct backing_dev_info *);
+
 #ifdef CONFIG_SWAP
 /* linux/mm/page_io.c */
 extern int swap_readpage(struct file *, struct page *);
@@ -216,7 +218,7 @@ extern sector_t map_swap_page(struct swa
 extern struct swap_info_struct *get_swap_info_struct(unsigned);
 extern int can_share_swap_page(struct page *);
 extern int remove_exclusive_swap_page(struct page *);
-extern void swap_unplug_io_fn(struct page *);
+struct backing_dev_info;
 
 extern struct swap_list_t swap_list;
 extern spinlock_t swaplock;
@@ -250,7 +252,6 @@ extern spinlock_t swaplock;
 #define move_from_swap_cache(p, i, m)		1
 #define __delete_from_swap_cache(p)		/*NOTHING*/
 #define delete_from_swap_cache(p)		/*NOTHING*/
-#define swap_unplug_io_fn(p)			/*NOTHING*/
 
 static inline int remove_exclusive_swap_page(struct page *p)
 {
diff -puN mm/filemap.c~rmap-5-swap_unplug-page-revert mm/filemap.c
--- 25/mm/filemap.c~rmap-5-swap_unplug-page-revert	2004-05-12 19:33:14.540138864 -0700
+++ 25-akpm/mm/filemap.c	2004-05-12 19:52:31.834203424 -0700
@@ -127,7 +127,7 @@ static inline int sync_page(struct page 
 		if (mapping->a_ops && mapping->a_ops->sync_page)
 			return mapping->a_ops->sync_page(page);
 	} else if (PageSwapCache(page)) {
-		swap_unplug_io_fn(page);
+		swap_unplug_io_fn(NULL);
 	}
 	return 0;
 }
diff -puN mm/nommu.c~rmap-5-swap_unplug-page-revert mm/nommu.c
--- 25/mm/nommu.c~rmap-5-swap_unplug-page-revert	2004-05-12 19:33:14.542138560 -0700
+++ 25-akpm/mm/nommu.c	2004-05-12 19:40:21.921167072 -0700
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/blkdev.h>
+#include <linux/backing-dev.h>
 
 #include <asm/pgalloc.h>
 #include <asm/uaccess.h>
@@ -571,3 +572,7 @@ unsigned long get_unmapped_area(struct f
 void pte_chain_init(void)
 {
 }
+
+void swap_unplug_io_fn(struct backing_dev_info *)
+{
+}
diff -puN mm/swapfile.c~rmap-5-swap_unplug-page-revert mm/swapfile.c
--- 25/mm/swapfile.c~rmap-5-swap_unplug-page-revert	2004-05-12 19:33:14.543138408 -0700
+++ 25-akpm/mm/swapfile.c	2004-05-12 19:52:49.643496000 -0700
@@ -88,26 +88,19 @@ static void remove_swap_bdev(struct bloc
 	BUG();
 }
 
-/*
- * Unlike a standard unplug_io_fn, swap_unplug_io_fn is never called
- * through swap's backing_dev_info (which is only used by shrink_list),
- * but directly from sync_page when PageSwapCache: and takes the page
- * as argument, so that it can find the right device from swp_entry_t.
- */
-void swap_unplug_io_fn(struct page *page)
+void swap_unplug_io_fn(struct backing_dev_info *unused_bdi)
 {
-	swp_entry_t entry;
+	int i;
 
 	down(&swap_bdevs_sem);
-	entry.val = page->private;
-	if (PageSwapCache(page)) {
-		struct block_device *bdev = swap_bdevs[swp_type(entry)];
+	for (i = 0; i < MAX_SWAPFILES; i++) {
+		struct block_device *bdev = swap_bdevs[i];
 		struct backing_dev_info *bdi;
 
-		if (bdev) {
-			bdi = bdev->bd_inode->i_mapping->backing_dev_info;
-			(*bdi->unplug_io_fn)(bdi);
-		}
+		if (bdev == NULL)
+			break;
+		bdi = bdev->bd_inode->i_mapping->backing_dev_info;
+		(*bdi->unplug_io_fn)(bdi);
 	}
 	up(&swap_bdevs_sem);
 }
diff -puN mm/swap_state.c~rmap-5-swap_unplug-page-revert mm/swap_state.c
--- 25/mm/swap_state.c~rmap-5-swap_unplug-page-revert	2004-05-12 19:33:14.544138256 -0700
+++ 25-akpm/mm/swap_state.c	2004-05-12 19:40:20.505382304 -0700
@@ -25,13 +25,13 @@ static struct address_space_operations s
 };
 
 static struct backing_dev_info swap_backing_dev_info = {
-	.state		= 0,	/* uncongested */
+	.memory_backed	= 1,	/* Does not contribute to dirty memory */
+	.unplug_io_fn	= swap_unplug_io_fn,
 };
 
 struct address_space swapper_space = {
 	.page_tree	= RADIX_TREE_INIT(GFP_ATOMIC),
 	.tree_lock	= SPIN_LOCK_UNLOCKED,
-	.nrpages	= 0,	/* total_swapcache_pages */
 	.a_ops		= &swap_aops,
 	.backing_dev_info = &swap_backing_dev_info,
 };

_