aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 87d935333f0d..9b8a01d941cb 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -305,6 +305,7 @@ int __tlb_remove_page(struct mmu_gather *tlb, struct page *page)
305 if (batch->nr == batch->max) { 305 if (batch->nr == batch->max) {
306 if (!tlb_next_batch(tlb)) 306 if (!tlb_next_batch(tlb))
307 return 0; 307 return 0;
308 batch = tlb->active;
308 } 309 }
309 VM_BUG_ON(batch->nr > batch->max); 310 VM_BUG_ON(batch->nr > batch->max);
310 311
@@ -2798,30 +2799,6 @@ void unmap_mapping_range(struct address_space *mapping,
2798} 2799}
2799EXPORT_SYMBOL(unmap_mapping_range); 2800EXPORT_SYMBOL(unmap_mapping_range);
2800 2801
2801int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end)
2802{
2803 struct address_space *mapping = inode->i_mapping;
2804
2805 /*
2806 * If the underlying filesystem is not going to provide
2807 * a way to truncate a range of blocks (punch a hole) -
2808 * we should return failure right now.
2809 */
2810 if (!inode->i_op->truncate_range)
2811 return -ENOSYS;
2812
2813 mutex_lock(&inode->i_mutex);
2814 down_write(&inode->i_alloc_sem);
2815 unmap_mapping_range(mapping, offset, (end - offset), 1);
2816 truncate_inode_pages_range(mapping, offset, end);
2817 unmap_mapping_range(mapping, offset, (end - offset), 1);
2818 inode->i_op->truncate_range(inode, offset, end);
2819 up_write(&inode->i_alloc_sem);
2820 mutex_unlock(&inode->i_mutex);
2821
2822 return 0;
2823}
2824
2825/* 2802/*
2826 * We enter with non-exclusive mmap_sem (to exclude vma changes, 2803 * We enter with non-exclusive mmap_sem (to exclude vma changes,
2827 * but allow concurrent faults), and pte mapped but not yet locked. 2804 * but allow concurrent faults), and pte mapped but not yet locked.