diff options
author | Hugh Dickins <hughd@google.com> | 2011-06-27 19:18:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-06-27 21:00:12 -0400 |
commit | 5b8ba10198a109f8a02380648c5d29000caa9c55 (patch) | |
tree | 1e4328d86395baa3d429c0d9911b7d7e1272629d | |
parent | 4d258b25d947521c8b913154db61ec55198243f8 (diff) |
mm: move vmtruncate_range to truncate.c
You would expect to find vmtruncate_range() next to vmtruncate() in
mm/truncate.c: move it there.
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/memory.c | 24 | ||||
-rw-r--r-- | mm/truncate.c | 24 |
2 files changed, 24 insertions, 24 deletions
diff --git a/mm/memory.c b/mm/memory.c index 87d935333f0d..40b7531ee8ba 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -2798,30 +2798,6 @@ void unmap_mapping_range(struct address_space *mapping, | |||
2798 | } | 2798 | } |
2799 | EXPORT_SYMBOL(unmap_mapping_range); | 2799 | EXPORT_SYMBOL(unmap_mapping_range); |
2800 | 2800 | ||
2801 | int 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 | /* | 2801 | /* |
2826 | * We enter with non-exclusive mmap_sem (to exclude vma changes, | 2802 | * We enter with non-exclusive mmap_sem (to exclude vma changes, |
2827 | * but allow concurrent faults), and pte mapped but not yet locked. | 2803 | * but allow concurrent faults), and pte mapped but not yet locked. |
diff --git a/mm/truncate.c b/mm/truncate.c index 3a29a6180212..5b4c3a4847e9 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -603,3 +603,27 @@ int vmtruncate(struct inode *inode, loff_t offset) | |||
603 | return 0; | 603 | return 0; |
604 | } | 604 | } |
605 | EXPORT_SYMBOL(vmtruncate); | 605 | EXPORT_SYMBOL(vmtruncate); |
606 | |||
607 | int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end) | ||
608 | { | ||
609 | struct address_space *mapping = inode->i_mapping; | ||
610 | |||
611 | /* | ||
612 | * If the underlying filesystem is not going to provide | ||
613 | * a way to truncate a range of blocks (punch a hole) - | ||
614 | * we should return failure right now. | ||
615 | */ | ||
616 | if (!inode->i_op->truncate_range) | ||
617 | return -ENOSYS; | ||
618 | |||
619 | mutex_lock(&inode->i_mutex); | ||
620 | down_write(&inode->i_alloc_sem); | ||
621 | unmap_mapping_range(mapping, offset, (end - offset), 1); | ||
622 | truncate_inode_pages_range(mapping, offset, end); | ||
623 | unmap_mapping_range(mapping, offset, (end - offset), 1); | ||
624 | inode->i_op->truncate_range(inode, offset, end); | ||
625 | up_write(&inode->i_alloc_sem); | ||
626 | mutex_unlock(&inode->i_mutex); | ||
627 | |||
628 | return 0; | ||
629 | } | ||