提交 72c72bdf 编写于 作者: A Anna Schumaker 提交者: J. Bruce Fields

VFS: Rename do_fallocate() to vfs_fallocate()

This function needs to be exported so it can be used by the NFSD module
when responding to the new ALLOCATE and DEALLOCATE operations in NFS
v4.2.  Christoph Hellwig suggested renaming the function to stay
consistent with how other vfs functions are named.
Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
上级 9af94fc4
...@@ -446,7 +446,7 @@ ashmem_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) ...@@ -446,7 +446,7 @@ ashmem_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
loff_t start = range->pgstart * PAGE_SIZE; loff_t start = range->pgstart * PAGE_SIZE;
loff_t end = (range->pgend + 1) * PAGE_SIZE; loff_t end = (range->pgend + 1) * PAGE_SIZE;
do_fallocate(range->asma->file, vfs_fallocate(range->asma->file,
FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
start, end - start); start, end - start);
range->purged = ASHMEM_WAS_PURGED; range->purged = ASHMEM_WAS_PURGED;
......
...@@ -443,7 +443,7 @@ int ioctl_preallocate(struct file *filp, void __user *argp) ...@@ -443,7 +443,7 @@ int ioctl_preallocate(struct file *filp, void __user *argp)
return -EINVAL; return -EINVAL;
} }
return do_fallocate(filp, FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len); return vfs_fallocate(filp, FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len);
} }
static int file_ioctl(struct file *filp, unsigned int cmd, static int file_ioctl(struct file *filp, unsigned int cmd,
......
...@@ -222,7 +222,7 @@ SYSCALL_DEFINE2(ftruncate64, unsigned int, fd, loff_t, length) ...@@ -222,7 +222,7 @@ SYSCALL_DEFINE2(ftruncate64, unsigned int, fd, loff_t, length)
#endif /* BITS_PER_LONG == 32 */ #endif /* BITS_PER_LONG == 32 */
int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
{ {
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
long ret; long ret;
...@@ -298,6 +298,7 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) ...@@ -298,6 +298,7 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
sb_end_write(inode->i_sb); sb_end_write(inode->i_sb);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(vfs_fallocate);
SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len) SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)
{ {
...@@ -305,7 +306,7 @@ SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len) ...@@ -305,7 +306,7 @@ SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)
int error = -EBADF; int error = -EBADF;
if (f.file) { if (f.file) {
error = do_fallocate(f.file, mode, offset, len); error = vfs_fallocate(f.file, mode, offset, len);
fdput(f); fdput(f);
} }
return error; return error;
......
...@@ -2032,7 +2032,7 @@ struct filename { ...@@ -2032,7 +2032,7 @@ struct filename {
extern long vfs_truncate(struct path *, loff_t); extern long vfs_truncate(struct path *, loff_t);
extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
struct file *filp); struct file *filp);
extern int do_fallocate(struct file *file, int mode, loff_t offset, extern int vfs_fallocate(struct file *file, int mode, loff_t offset,
loff_t len); loff_t len);
extern long do_sys_open(int dfd, const char __user *filename, int flags, extern long do_sys_open(int dfd, const char __user *filename, int flags,
umode_t mode); umode_t mode);
......
...@@ -326,7 +326,7 @@ static long madvise_remove(struct vm_area_struct *vma, ...@@ -326,7 +326,7 @@ static long madvise_remove(struct vm_area_struct *vma,
*/ */
get_file(f); get_file(f);
up_read(&current->mm->mmap_sem); up_read(&current->mm->mmap_sem);
error = do_fallocate(f, error = vfs_fallocate(f,
FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
offset, end - start); offset, end - start);
fput(f); fput(f);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册