patch-2.4.0-test6 linux/mm/filemap.c

Next file: linux/mm/highmem.c
Previous file: linux/mm/bootmem.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test5/linux/mm/filemap.c linux/mm/filemap.c
@@ -294,7 +294,13 @@
 		 * of zone - it's old.
 		 */
 		if (page->buffers) {
-			int wait = ((gfp_mask & __GFP_IO) && (nr_dirty-- < 0));
+			int wait;
+			/*
+			 * 0 - free it if can do so without IO
+			 * 1 - start write-out of dirty buffers
+			 * 2 - wait for locked buffers
+			 */
+			wait = (gfp_mask & __GFP_IO) ? (nr_dirty-- < 0) ? 2 : 1 : 0;
 			if (!try_to_free_buffers(page, wait))
 				goto unlock_continue;
 			/* page was locked, inode can't go away under us */
@@ -2509,8 +2515,9 @@
 		status = mapping->a_ops->prepare_write(file, page, offset, offset+bytes);
 		if (status)
 			goto unlock;
-		kaddr = (char*)page_address(page);
+		kaddr = page_address(page);
 		status = copy_from_user(kaddr+offset, buf, bytes);
+		flush_dcache_page(page);
 		if (status)
 			goto fail_write;
 		status = mapping->a_ops->commit_write(file, page, offset, offset+bytes);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)