patch-2.3.27 linux/mm/filemap.c

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

diff -u --recursive --new-file v2.3.26/linux/mm/filemap.c linux/mm/filemap.c
@@ -21,11 +21,13 @@
 #include <linux/swapctl.h>
 #include <linux/slab.h>
 #include <linux/init.h>
-#include <linux/highmem.h>
+#include <linux/mm.h>
 
 #include <asm/pgtable.h>
 #include <asm/uaccess.h>
 
+#include <linux/highmem.h>
+
 /*
  * Shared mappings implemented 30.11.1994. It's not fully working yet,
  * though.
@@ -1142,12 +1144,10 @@
 
 	if (size > count)
 		size = count;
-	/*
-	 * FIXME: We cannot yet sleep with kmaps held.
-	 */
-	kaddr = kmap(page, KM_READ);
-	left = __copy_to_user(desc->buf, (void *)(kaddr+offset), size);
-	kunmap(kaddr, KM_READ);
+
+	kaddr = kmap(page);
+	left = __copy_to_user(desc->buf, (void *)(kaddr + offset), size);
+	kunmap(page);
 	
 	if (left) {
 		size -= left;
@@ -1200,9 +1200,11 @@
 		size = count;
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
-	kaddr = kmap(page, KM_READ);
-	written = file->f_op->write(file, (char *)kaddr + offset, size, &file->f_pos);
-	kunmap(kaddr, KM_READ);
+
+	kaddr = kmap(page);
+	written = file->f_op->write(file, (char *)kaddr + offset,
+						 size, &file->f_pos);
+	kunmap(page);
 	set_fs(old_fs);
 	if (written < 0) {
 		desc->error = written;
@@ -1347,8 +1349,6 @@
 		struct page *new_page = page_cache_alloc();
 
 		if (new_page) {
-			if (PageHighMem(new_page) || PageHighMem(old_page))
-				BUG();
 			copy_highpage(new_page, old_page);
 			flush_page_to_ram(new_page);
 		} else
@@ -1530,8 +1530,6 @@
 			return 0;
 		}
 	}
-	if (PageHighMem(page))
-		BUG();
 	pgoff = (address - vma->vm_start) >> PAGE_CACHE_SHIFT;
 	pgoff += vma->vm_pgoff;
 	if (page->index != pgoff) {

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