aboutsummaryrefslogtreecommitdiffstats
path: root/mm/msync.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2006-03-24 06:18:15 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-24 10:33:27 -0500
commit8f2e9f157a94f444dad974b088b853ac40785b02 (patch)
treea8a3b2413ffb2a4a6f84762f052f0f6b4699ef9a /mm/msync.c
parent18e79b40ed9c5223b88771f805c69f5993fc131b (diff)
[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 d6a50f3f28b6..2672b8dc3d89 100644
--- a/mm/msync.c
+++ b/mm/msync.c
@@ -9,6 +9,7 @@
9 */ 9 */
10#include <linux/slab.h> 10#include <linux/slab.h>
11#include <linux/pagemap.h> 11#include <linux/pagemap.h>
12#include <linux/fs.h>
12#include <linux/mm.h> 13#include <linux/mm.h>
13#include <linux/mman.h> 14#include <linux/mman.h>
14#include <linux/hugetlb.h> 15#include <linux/hugetlb.h>
@@ -214,23 +215,9 @@ asmlinkage long sys_msync(unsigned long start, size_t len, int flags)
214 vma = find_vma(current->mm, start); 215 vma = find_vma(current->mm, start);
215 } else if ((flags & MS_SYNC) && file && 216 } else if ((flags & MS_SYNC) && file &&
216 (vma->vm_flags & VM_SHARED)) { 217 (vma->vm_flags & VM_SHARED)) {
217 struct address_space *mapping;
218 int err;
219
220 get_file(file); 218 get_file(file);
221 up_read(&current->mm->mmap_sem); 219 up_read(&current->mm->mmap_sem);
222 mapping = file->f_mapping; 220 error = do_fsync(file, 0);
223 error = filemap_fdatawrite(mapping);
224 if (file->f_op && file->f_op->fsync) {
225 mutex_lock(&mapping->host->i_mutex);
226 err = file->f_op->fsync(file,file->f_dentry,1);
227 mutex_unlock(&mapping->host->i_mutex);
228 if (err && !error)
229 error = err;
230 }
231 err = filemap_fdatawait(mapping);
232 if (err && !error)
233 error = err;
234 fput(file); 221 fput(file);
235 down_read(&current->mm->mmap_sem); 222 down_read(&current->mm->mmap_sem);
236 if (error) 223 if (error)