summaryrefslogtreecommitdiff
path: root/mm/msync.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2006-03-24 03:18:15 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-24 07:33:27 -0800
commit8f2e9f157a94f444dad974b088b853ac40785b02 (patch)
treea8a3b2413ffb2a4a6f84762f052f0f6b4699ef9a /mm/msync.c
parent18e79b40ed9c5223b88771f805c69f5993fc131b (diff)
downloadlinux-3.10-8f2e9f157a94f444dad974b088b853ac40785b02.tar.gz
linux-3.10-8f2e9f157a94f444dad974b088b853ac40785b02.tar.bz2
linux-3.10-8f2e9f157a94f444dad974b088b853ac40785b02.zip
[PATCH] msync(): use do_fsync()
No need to duplicate all that code. Cc: Hugh Dickins <hugh@veritas.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/msync.c')
-rw-r--r--mm/msync.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/mm/msync.c b/mm/msync.c
index d6a50f3f28b..2672b8dc3d8 100644
--- a/mm/msync.c
+++ b/mm/msync.c
@@ -9,6 +9,7 @@
*/
#include <linux/slab.h>
#include <linux/pagemap.h>
+#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/mman.h>
#include <linux/hugetlb.h>
@@ -214,23 +215,9 @@ asmlinkage long sys_msync(unsigned long start, size_t len, int flags)
vma = find_vma(current->mm, start);
} else if ((flags & MS_SYNC) && file &&
(vma->vm_flags & VM_SHARED)) {
- struct address_space *mapping;
- int err;
-
get_file(file);
up_read(&current->mm->mmap_sem);
- mapping = file->f_mapping;
- error = filemap_fdatawrite(mapping);
- if (file->f_op && file->f_op->fsync) {
- mutex_lock(&mapping->host->i_mutex);
- err = file->f_op->fsync(file,file->f_dentry,1);
- mutex_unlock(&mapping->host->i_mutex);
- if (err && !error)
- error = err;
- }
- err = filemap_fdatawait(mapping);
- if (err && !error)
- error = err;
+ error = do_fsync(file, 0);
fput(file);
down_read(&current->mm->mmap_sem);
if (error)