diff options
author | Hugh Dickins <hughd@google.com> | 2012-05-29 18:06:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 19:22:23 -0400 |
commit | 17cf28afea2a1112f240a3a2da8af883be024811 (patch) | |
tree | ed9e3eb9b1d44118a12e4ecdf369e3b9b3208be1 /mm | |
parent | 3f31d07571eeea18a7d34db9af21d2285b807a17 (diff) |
mm/fs: remove truncate_range
Remove vmtruncate_range(), and remove the truncate_range method from
struct inode_operations: only tmpfs ever supported it, and tmpfs has now
converted over to using the fallocate method of file_operations.
Update Documentation accordingly, adding (setlease and) fallocate lines.
And while we're in mm.h, remove duplicate declarations of shmem_lock() and
shmem_file_setup(): everyone is now using the ones in shmem_fs.h.
Based-on-patch-by: Cong Wang <amwang@redhat.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Cong Wang <amwang@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/shmem.c | 1 | ||||
-rw-r--r-- | mm/truncate.c | 25 |
2 files changed, 0 insertions, 26 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 7e54ff1c63e1..f368d0acb52c 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2541,7 +2541,6 @@ static const struct file_operations shmem_file_operations = { | |||
2541 | 2541 | ||
2542 | static const struct inode_operations shmem_inode_operations = { | 2542 | static const struct inode_operations shmem_inode_operations = { |
2543 | .setattr = shmem_setattr, | 2543 | .setattr = shmem_setattr, |
2544 | .truncate_range = shmem_truncate_range, | ||
2545 | #ifdef CONFIG_TMPFS_XATTR | 2544 | #ifdef CONFIG_TMPFS_XATTR |
2546 | .setxattr = shmem_setxattr, | 2545 | .setxattr = shmem_setxattr, |
2547 | .getxattr = shmem_getxattr, | 2546 | .getxattr = shmem_getxattr, |
diff --git a/mm/truncate.c b/mm/truncate.c index 61a183b89df6..75801acdaac7 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -602,31 +602,6 @@ int vmtruncate(struct inode *inode, loff_t newsize) | |||
602 | } | 602 | } |
603 | EXPORT_SYMBOL(vmtruncate); | 603 | EXPORT_SYMBOL(vmtruncate); |
604 | 604 | ||
605 | int vmtruncate_range(struct inode *inode, loff_t lstart, loff_t lend) | ||
606 | { | ||
607 | struct address_space *mapping = inode->i_mapping; | ||
608 | loff_t holebegin = round_up(lstart, PAGE_SIZE); | ||
609 | loff_t holelen = 1 + lend - holebegin; | ||
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 | inode_dio_wait(inode); | ||
621 | unmap_mapping_range(mapping, holebegin, holelen, 1); | ||
622 | inode->i_op->truncate_range(inode, lstart, lend); | ||
623 | /* unmap again to remove racily COWed private pages */ | ||
624 | unmap_mapping_range(mapping, holebegin, holelen, 1); | ||
625 | mutex_unlock(&inode->i_mutex); | ||
626 | |||
627 | return 0; | ||
628 | } | ||
629 | |||
630 | /** | 605 | /** |
631 | * truncate_pagecache_range - unmap and remove pagecache that is hole-punched | 606 | * truncate_pagecache_range - unmap and remove pagecache that is hole-punched |
632 | * @inode: inode | 607 | * @inode: inode |