Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17cf28af authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds
Browse files

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: default avatarCong Wang <amwang@redhat.com>
Signed-off-by: default avatarHugh 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3f31d075
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -60,7 +60,6 @@ ata *);
	ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
	ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
	ssize_t (*listxattr) (struct dentry *, char *, size_t);
	ssize_t (*listxattr) (struct dentry *, char *, size_t);
	int (*removexattr) (struct dentry *, const char *);
	int (*removexattr) (struct dentry *, const char *);
	void (*truncate_range)(struct inode *, loff_t, loff_t);
	int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len);
	int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len);


locking rules:
locking rules:
@@ -87,7 +86,6 @@ setxattr: yes
getxattr:	no
getxattr:	no
listxattr:	no
listxattr:	no
removexattr:	yes
removexattr:	yes
truncate_range:	yes
fiemap:		no
fiemap:		no
	Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
	Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
victim.
victim.
+8 −5
Original line number Original line Diff line number Diff line
@@ -363,7 +363,6 @@ struct inode_operations {
	ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
	ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
	ssize_t (*listxattr) (struct dentry *, char *, size_t);
	ssize_t (*listxattr) (struct dentry *, char *, size_t);
	int (*removexattr) (struct dentry *, const char *);
	int (*removexattr) (struct dentry *, const char *);
	void (*truncate_range)(struct inode *, loff_t, loff_t);
};
};


Again, all methods are called without any locks being held, unless
Again, all methods are called without any locks being held, unless
@@ -472,9 +471,6 @@ otherwise noted.
  removexattr: called by the VFS to remove an extended attribute from
  removexattr: called by the VFS to remove an extended attribute from
  	a file. This method is called by removexattr(2) system call.
  	a file. This method is called by removexattr(2) system call.


  truncate_range: a method provided by the underlying filesystem to truncate a
  	range of blocks , i.e. punch a hole somewhere in a file.



The Address Space Object
The Address Space Object
========================
========================
@@ -760,7 +756,7 @@ struct file_operations
----------------------
----------------------


This describes how the VFS can manipulate an open file. As of kernel
This describes how the VFS can manipulate an open file. As of kernel
2.6.22, the following members are defined:
3.5, the following members are defined:


struct file_operations {
struct file_operations {
	struct module *owner;
	struct module *owner;
@@ -790,6 +786,8 @@ struct file_operations {
	int (*flock) (struct file *, int, struct file_lock *);
	int (*flock) (struct file *, int, struct file_lock *);
	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, size_t, unsigned int);
	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, size_t, unsigned int);
	ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned int);
	ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned int);
	int (*setlease)(struct file *, long arg, struct file_lock **);
	long (*fallocate)(struct file *, int mode, loff_t offset, loff_t len);
};
};


Again, all methods are called without any locks being held, unless
Again, all methods are called without any locks being held, unless
@@ -858,6 +856,11 @@ otherwise noted.
  splice_read: called by the VFS to splice data from file to a pipe. This
  splice_read: called by the VFS to splice data from file to a pipe. This
	       method is used by the splice(2) system call
	       method is used by the splice(2) system call


  setlease: called by the VFS to set or release a file lock lease.
	    setlease has the file_lock_lock held and must not sleep.

  fallocate: called by the VFS to preallocate blocks or punch a hole.

Note that the file operations are implemented by the specific
Note that the file operations are implemented by the specific
filesystem in which the inode resides. When opening a device node
filesystem in which the inode resides. When opening a device node
(character or block special) most filesystems will call special
(character or block special) most filesystems will call special
+0 −1
Original line number Original line Diff line number Diff line
@@ -292,7 +292,6 @@ static const struct inode_operations bad_inode_ops =
	.getxattr	= bad_inode_getxattr,
	.getxattr	= bad_inode_getxattr,
	.listxattr	= bad_inode_listxattr,
	.listxattr	= bad_inode_listxattr,
	.removexattr	= bad_inode_removexattr,
	.removexattr	= bad_inode_removexattr,
	/* truncate_range returns void */
};
};




+0 −1
Original line number Original line Diff line number Diff line
@@ -1681,7 +1681,6 @@ struct inode_operations {
	ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
	ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
	ssize_t (*listxattr) (struct dentry *, char *, size_t);
	ssize_t (*listxattr) (struct dentry *, char *, size_t);
	int (*removexattr) (struct dentry *, const char *);
	int (*removexattr) (struct dentry *, const char *);
	void (*truncate_range)(struct inode *, loff_t, loff_t);
	int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
	int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
		      u64 len);
		      u64 len);
} ____cacheline_aligned;
} ____cacheline_aligned;
+0 −4
Original line number Original line Diff line number Diff line
@@ -871,8 +871,6 @@ extern void pagefault_out_of_memory(void);
extern void show_free_areas(unsigned int flags);
extern void show_free_areas(unsigned int flags);
extern bool skip_free_areas_node(unsigned int flags, int nid);
extern bool skip_free_areas_node(unsigned int flags, int nid);


int shmem_lock(struct file *file, int lock, struct user_struct *user);
struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
int shmem_zero_setup(struct vm_area_struct *);
int shmem_zero_setup(struct vm_area_struct *);


extern int can_do_mlock(void);
extern int can_do_mlock(void);
@@ -951,11 +949,9 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new);
extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new);
extern void truncate_setsize(struct inode *inode, loff_t newsize);
extern void truncate_setsize(struct inode *inode, loff_t newsize);
extern int vmtruncate(struct inode *inode, loff_t offset);
extern int vmtruncate(struct inode *inode, loff_t offset);
extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end);
void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end);
void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end);
int truncate_inode_page(struct address_space *mapping, struct page *page);
int truncate_inode_page(struct address_space *mapping, struct page *page);
int generic_error_remove_page(struct address_space *mapping, struct page *page);
int generic_error_remove_page(struct address_space *mapping, struct page *page);

int invalidate_inode_page(struct page *page);
int invalidate_inode_page(struct page *page);


#ifdef CONFIG_MMU
#ifdef CONFIG_MMU
Loading