diff options
-rw-r--r-- | Documentation/filesystems/Locking | 2 | ||||
-rw-r--r-- | Documentation/filesystems/vfs.txt | 13 | ||||
-rw-r--r-- | fs/bad_inode.c | 1 | ||||
-rw-r--r-- | include/linux/fs.h | 1 | ||||
-rw-r--r-- | include/linux/mm.h | 4 | ||||
-rw-r--r-- | mm/shmem.c | 1 | ||||
-rw-r--r-- | mm/truncate.c | 25 |
7 files changed, 8 insertions, 39 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 4fca82e5276e..d449e632e6a0 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -60,7 +60,6 @@ ata *); | |||
60 | ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); | 60 | ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); |
61 | ssize_t (*listxattr) (struct dentry *, char *, size_t); | 61 | ssize_t (*listxattr) (struct dentry *, char *, size_t); |
62 | int (*removexattr) (struct dentry *, const char *); | 62 | int (*removexattr) (struct dentry *, const char *); |
63 | void (*truncate_range)(struct inode *, loff_t, loff_t); | ||
64 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len); | 63 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len); |
65 | 64 | ||
66 | locking rules: | 65 | locking rules: |
@@ -87,7 +86,6 @@ setxattr: yes | |||
87 | getxattr: no | 86 | getxattr: no |
88 | listxattr: no | 87 | listxattr: no |
89 | removexattr: yes | 88 | removexattr: yes |
90 | truncate_range: yes | ||
91 | fiemap: no | 89 | fiemap: no |
92 | Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on | 90 | Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on |
93 | victim. | 91 | victim. |
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index 0d0492028082..ef19f91a0f12 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -363,7 +363,6 @@ struct inode_operations { | |||
363 | ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); | 363 | ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); |
364 | ssize_t (*listxattr) (struct dentry *, char *, size_t); | 364 | ssize_t (*listxattr) (struct dentry *, char *, size_t); |
365 | int (*removexattr) (struct dentry *, const char *); | 365 | int (*removexattr) (struct dentry *, const char *); |
366 | void (*truncate_range)(struct inode *, loff_t, loff_t); | ||
367 | }; | 366 | }; |
368 | 367 | ||
369 | Again, all methods are called without any locks being held, unless | 368 | Again, all methods are called without any locks being held, unless |
@@ -472,9 +471,6 @@ otherwise noted. | |||
472 | removexattr: called by the VFS to remove an extended attribute from | 471 | removexattr: called by the VFS to remove an extended attribute from |
473 | a file. This method is called by removexattr(2) system call. | 472 | a file. This method is called by removexattr(2) system call. |
474 | 473 | ||
475 | truncate_range: a method provided by the underlying filesystem to truncate a | ||
476 | range of blocks , i.e. punch a hole somewhere in a file. | ||
477 | |||
478 | 474 | ||
479 | The Address Space Object | 475 | The Address Space Object |
480 | ======================== | 476 | ======================== |
@@ -760,7 +756,7 @@ struct file_operations | |||
760 | ---------------------- | 756 | ---------------------- |
761 | 757 | ||
762 | This describes how the VFS can manipulate an open file. As of kernel | 758 | This describes how the VFS can manipulate an open file. As of kernel |
763 | 2.6.22, the following members are defined: | 759 | 3.5, the following members are defined: |
764 | 760 | ||
765 | struct file_operations { | 761 | struct file_operations { |
766 | struct module *owner; | 762 | struct module *owner; |
@@ -790,6 +786,8 @@ struct file_operations { | |||
790 | int (*flock) (struct file *, int, struct file_lock *); | 786 | int (*flock) (struct file *, int, struct file_lock *); |
791 | ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, size_t, unsigned int); | 787 | ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, size_t, unsigned int); |
792 | ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned int); | 788 | ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned int); |
789 | int (*setlease)(struct file *, long arg, struct file_lock **); | ||
790 | long (*fallocate)(struct file *, int mode, loff_t offset, loff_t len); | ||
793 | }; | 791 | }; |
794 | 792 | ||
795 | Again, all methods are called without any locks being held, unless | 793 | Again, all methods are called without any locks being held, unless |
@@ -858,6 +856,11 @@ otherwise noted. | |||
858 | splice_read: called by the VFS to splice data from file to a pipe. This | 856 | splice_read: called by the VFS to splice data from file to a pipe. This |
859 | method is used by the splice(2) system call | 857 | method is used by the splice(2) system call |
860 | 858 | ||
859 | setlease: called by the VFS to set or release a file lock lease. | ||
860 | setlease has the file_lock_lock held and must not sleep. | ||
861 | |||
862 | fallocate: called by the VFS to preallocate blocks or punch a hole. | ||
863 | |||
861 | Note that the file operations are implemented by the specific | 864 | Note that the file operations are implemented by the specific |
862 | filesystem in which the inode resides. When opening a device node | 865 | filesystem in which the inode resides. When opening a device node |
863 | (character or block special) most filesystems will call special | 866 | (character or block special) most filesystems will call special |
diff --git a/fs/bad_inode.c b/fs/bad_inode.c index 37268c5bb98b..1b35d6bd06b0 100644 --- a/fs/bad_inode.c +++ b/fs/bad_inode.c | |||
@@ -292,7 +292,6 @@ static const struct inode_operations bad_inode_ops = | |||
292 | .getxattr = bad_inode_getxattr, | 292 | .getxattr = bad_inode_getxattr, |
293 | .listxattr = bad_inode_listxattr, | 293 | .listxattr = bad_inode_listxattr, |
294 | .removexattr = bad_inode_removexattr, | 294 | .removexattr = bad_inode_removexattr, |
295 | /* truncate_range returns void */ | ||
296 | }; | 295 | }; |
297 | 296 | ||
298 | 297 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index cdc1a9630948..038076b27ea4 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1681,7 +1681,6 @@ struct inode_operations { | |||
1681 | ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); | 1681 | ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); |
1682 | ssize_t (*listxattr) (struct dentry *, char *, size_t); | 1682 | ssize_t (*listxattr) (struct dentry *, char *, size_t); |
1683 | int (*removexattr) (struct dentry *, const char *); | 1683 | int (*removexattr) (struct dentry *, const char *); |
1684 | void (*truncate_range)(struct inode *, loff_t, loff_t); | ||
1685 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, | 1684 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, |
1686 | u64 len); | 1685 | u64 len); |
1687 | } ____cacheline_aligned; | 1686 | } ____cacheline_aligned; |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 7d5c37f24c63..aa20bafa40f6 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -871,8 +871,6 @@ extern void pagefault_out_of_memory(void); | |||
871 | extern void show_free_areas(unsigned int flags); | 871 | extern void show_free_areas(unsigned int flags); |
872 | extern bool skip_free_areas_node(unsigned int flags, int nid); | 872 | extern bool skip_free_areas_node(unsigned int flags, int nid); |
873 | 873 | ||
874 | int shmem_lock(struct file *file, int lock, struct user_struct *user); | ||
875 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); | ||
876 | int shmem_zero_setup(struct vm_area_struct *); | 874 | int shmem_zero_setup(struct vm_area_struct *); |
877 | 875 | ||
878 | extern int can_do_mlock(void); | 876 | extern int can_do_mlock(void); |
@@ -951,11 +949,9 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping, | |||
951 | extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new); | 949 | extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new); |
952 | extern void truncate_setsize(struct inode *inode, loff_t newsize); | 950 | extern void truncate_setsize(struct inode *inode, loff_t newsize); |
953 | extern int vmtruncate(struct inode *inode, loff_t offset); | 951 | extern int vmtruncate(struct inode *inode, loff_t offset); |
954 | extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end); | ||
955 | void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end); | 952 | void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end); |
956 | int truncate_inode_page(struct address_space *mapping, struct page *page); | 953 | int truncate_inode_page(struct address_space *mapping, struct page *page); |
957 | int generic_error_remove_page(struct address_space *mapping, struct page *page); | 954 | int generic_error_remove_page(struct address_space *mapping, struct page *page); |
958 | |||
959 | int invalidate_inode_page(struct page *page); | 955 | int invalidate_inode_page(struct page *page); |
960 | 956 | ||
961 | #ifdef CONFIG_MMU | 957 | #ifdef CONFIG_MMU |
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 |