patch-1.3.59 linux/mm/page_io.c

Next file: linux/mm/swap.c
Previous file: linux/mm/page_alloc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.58/linux/mm/page_io.c linux/mm/page_io.c
@@ -28,11 +28,12 @@
 
 static struct wait_queue * lock_queue = NULL;
 
-void rw_swap_page(int rw, unsigned long entry, char * buf)
+void rw_swap_page(int rw, unsigned long entry, char * buf, int wait)
 {
 	unsigned long type, offset;
 	struct swap_info_struct * p;
-
+	struct page *page;
+	
 	type = SWP_TYPE(entry);
 	if (type >= nr_swapfiles) {
 		printk("Internal error: bad swap-device\n");
@@ -58,8 +59,17 @@
 		kstat.pswpin++;
 	else
 		kstat.pswpout++;
+	page = mem_map + MAP_NR(buf);
+	wait_on_page(page);
 	if (p->swap_device) {
+		if (!wait) {
+			page->count++;
+			page->free_after = 1;
+			nr_async_pages++;
+		}
 		ll_rw_page(rw,p->swap_device,offset,buf);
+		if (wait)
+			wait_on_page(page);
 	} else if (p->swap_file) {
 		struct inode *swapf = p->swap_file;
 		unsigned int zones[PAGE_SIZE/512];
@@ -105,4 +115,3 @@
 		printk("rw_swap_page: lock already cleared\n");
 	wake_up(&lock_queue);
 }
-

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this