aboutsummaryrefslogtreecommitdiff
path: root/mm/tiny-shmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/tiny-shmem.c')
-rw-r--r--mm/tiny-shmem.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/mm/tiny-shmem.c b/mm/tiny-shmem.c
index 3e67d575ee6..b00e6fdcc56 100644
--- a/mm/tiny-shmem.c
+++ b/mm/tiny-shmem.c
@@ -97,6 +97,22 @@ put_memory:
}
EXPORT_SYMBOL_GPL(shmem_file_setup);
+void shmem_set_file(struct vm_area_struct *vma, struct file *file)
+{
+ if (vma->vm_file)
+ fput(vma->vm_file);
+ vma->vm_file = file;
+ vma->vm_ops = &generic_file_vm_ops;
+}
+
+void shmem_set_file(struct vm_area_struct *vma, struct file *file)
+{
+ if (vma->vm_file)
+ fput(vma->vm_file);
+ vma->vm_file = file;
+ vma->vm_ops = &generic_file_vm_ops;
+}
+
/**
* shmem_zero_setup - setup a shared anonymous mapping
* @vma: the vma to be mmapped is prepared by do_mmap_pgoff
@@ -110,10 +126,8 @@ int shmem_zero_setup(struct vm_area_struct *vma)
if (IS_ERR(file))
return PTR_ERR(file);
- if (vma->vm_file)
- fput(vma->vm_file);
- vma->vm_file = file;
- vma->vm_ops = &generic_file_vm_ops;
+ shmem_set_file(vma, file);
+
return 0;
}