From: Andrew Morton Date: Fri, 24 Mar 2006 11:18:15 +0000 (-0800) Subject: [PATCH] msync(): use do_fsync() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8f2e9f157a94f444dad974b088b853ac40785b02;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [PATCH] msync(): use do_fsync() No need to duplicate all that code. Cc: Hugh Dickins Cc: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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 @@ */ #include #include +#include #include #include #include @@ -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(¤t->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(¤t->mm->mmap_sem); if (error)