mmc: s3c6410: enable ADMA feature in 6410 sdhci controller
[safe/jmp/linux-2.6] / mm / filemap_xip.c
index b5167df..83364df 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/sched.h>
 #include <linux/seqlock.h>
 #include <linux/mutex.h>
+#include <linux/gfp.h>
 #include <asm/tlbflush.h>
 #include <asm/io.h>
 
@@ -89,8 +90,8 @@ do_xip_mapping_read(struct address_space *mapping,
                        }
                }
                nr = nr - offset;
-               if (nr > len)
-                       nr = len;
+               if (nr > len - copied)
+                       nr = len - copied;
 
                error = mapping->a_ops->get_xip_mem(mapping, index, 0,
                                                        &xip_mem, &xip_pfn);
@@ -193,8 +194,8 @@ retry:
                        /* Nuke the page table entry. */
                        flush_cache_page(vma, address, pte_pfn(*pte));
                        pteval = ptep_clear_flush_notify(vma, address, pte);
-                       page_remove_rmap(page, vma);
-                       dec_mm_counter(mm, file_rss);
+                       page_remove_rmap(page);
+                       dec_mm_counter(mm, MM_FILEPAGES);
                        BUG_ON(pte_dirty(pteval));
                        pte_unmap_unlock(pte, ptl);
                        page_cache_release(page);
@@ -296,7 +297,7 @@ out:
        }
 }
 
-static struct vm_operations_struct xip_file_vm_ops = {
+static const struct vm_operations_struct xip_file_vm_ops = {
        .fault  = xip_file_fault,
 };