x86, espfix: Make espfix64 a Kconfig option, fix UML
[pandora-kernel.git] / mm / truncate.c
index b40ac6d..40d186f 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/gfp.h>
 #include <linux/mm.h>
 #include <linux/swap.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/pagemap.h>
 #include <linux/highmem.h>
 #include <linux/pagevec.h>
@@ -394,11 +394,12 @@ invalidate_complete_page2(struct address_space *mapping, struct page *page)
        if (page_has_private(page) && !try_to_release_page(page, GFP_KERNEL))
                return 0;
 
+       clear_page_mlock(page);
+
        spin_lock_irq(&mapping->tree_lock);
        if (PageDirty(page))
                goto failed;
 
-       clear_page_mlock(page);
        BUG_ON(page_has_private(page));
        __delete_from_page_cache(page);
        spin_unlock_irq(&mapping->tree_lock);
@@ -601,28 +602,3 @@ int vmtruncate(struct inode *inode, loff_t newsize)
        return 0;
 }
 EXPORT_SYMBOL(vmtruncate);
-
-int vmtruncate_range(struct inode *inode, loff_t lstart, loff_t lend)
-{
-       struct address_space *mapping = inode->i_mapping;
-       loff_t holebegin = round_up(lstart, PAGE_SIZE);
-       loff_t holelen = 1 + lend - holebegin;
-
-       /*
-        * If the underlying filesystem is not going to provide
-        * a way to truncate a range of blocks (punch a hole) -
-        * we should return failure right now.
-        */
-       if (!inode->i_op->truncate_range)
-               return -ENOSYS;
-
-       mutex_lock(&inode->i_mutex);
-       inode_dio_wait(inode);
-       unmap_mapping_range(mapping, holebegin, holelen, 1);
-       inode->i_op->truncate_range(inode, lstart, lend);
-       /* unmap again to remove racily COWed private pages */
-       unmap_mapping_range(mapping, holebegin, holelen, 1);
-       mutex_unlock(&inode->i_mutex);
-
-       return 0;
-}