Merge branch 'for-linus' of git://www.linux-m32r.org/git/takata/linux-2.6_dev
[firefly-linux-kernel-4.4.55.git] / fs / adfs / dir.c
index e867ccf372466aaa495d360cc1605fb43a05dc95..23aa52f548a068d8c23f00a8cbc10293975924ee 100644 (file)
@@ -9,15 +9,7 @@
  *
  *  Common directory handling for ADFS
  */
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/adfs_fs.h>
-#include <linux/time.h>
-#include <linux/stat.h>
-#include <linux/spinlock.h>
 #include <linux/smp_lock.h>
-#include <linux/buffer_head.h>         /* for file_fsync() */
-
 #include "adfs.h"
 
 /*
@@ -83,7 +75,7 @@ out:
 }
 
 int
-adfs_dir_update(struct super_block *sb, struct object_info *obj)
+adfs_dir_update(struct super_block *sb, struct object_info *obj, int wait)
 {
        int ret = -EINVAL;
 #ifdef CONFIG_ADFS_FS_RW
@@ -106,6 +98,12 @@ adfs_dir_update(struct super_block *sb, struct object_info *obj)
        ret = ops->update(&dir, obj);
        write_unlock(&adfs_dir_lock);
 
+       if (wait) {
+               int err = ops->sync(&dir);
+               if (!ret)
+                       ret = err;
+       }
+
        ops->free(&dir);
 out:
 #endif
@@ -199,7 +197,7 @@ const struct file_operations adfs_dir_operations = {
        .read           = generic_read_dir,
        .llseek         = generic_file_llseek,
        .readdir        = adfs_readdir,
-       .fsync          = file_fsync,
+       .fsync          = simple_fsync,
 };
 
 static int