patch-2.1.37 linux/mm/page_io.c

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

diff -u --recursive --new-file v2.1.36/linux/mm/page_io.c linux/mm/page_io.c
@@ -67,7 +67,7 @@
 		return;
 	}
 	/* Make sure we are the only process doing I/O with this swap page. */
-	while (set_bit(offset,p->swap_lockmap)) {
+	while (test_and_set_bit(offset,p->swap_lockmap)) {
 		run_task_queue(&tq_disk);
 		sleep_on(&lock_queue);
 	}
@@ -136,7 +136,7 @@
 	} else
 		printk("rw_swap_page: no swap file or device\n");
 	atomic_dec(&page->count);
-	if (offset && !clear_bit(offset,p->swap_lockmap))
+	if (offset && !test_and_clear_bit(offset,p->swap_lockmap))
 		printk("rw_swap_page: lock already cleared\n");
 	wake_up(&lock_queue);
 }
@@ -158,7 +158,7 @@
 		printk("swap_after_unlock_page: weirdness\n");
 		return;
 	}
-	if (!clear_bit(offset,p->swap_lockmap))
+	if (!test_and_clear_bit(offset,p->swap_lockmap))
 		printk("swap_after_unlock_page: lock already cleared\n");
 	wake_up(&lock_queue);
 }
@@ -187,7 +187,7 @@
 			panic("ll_rw_page: bad block dev cmd, must be R/W");
 	}
 	page = mem_map + MAP_NR(buffer);
-	if (set_bit(PG_locked, &page->flags))
+	if (test_and_set_bit(PG_locked, &page->flags))
 		panic ("ll_rw_page: page already locked");
 	brw_page(rw, page, dev, &block, PAGE_SIZE, 0);
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov