Initial Samsung SPH-L900 Update 1 source
/fs/sync.c
blob:c38ec163da6ccba00a0146c75606c1b548b31343 -> blob:944ab9f2c730db7965fc83bf09496a634aa24789
--- fs/sync.c
+++ fs/sync.c
@@ -18,6 +18,10 @@
#include <linux/backing-dev.h>
#include "internal.h"
+#ifdef CONFIG_DYNAMIC_FSYNC
+extern bool early_suspend_active;
+#endif
+
#define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \
SYNC_FILE_RANGE_WAIT_AFTER)
@@ -87,7 +91,7 @@ static void sync_one_sb(struct super_blo
* Sync all the data for all the filesystems (called by sys_sync() and
* emergency sync)
*/
-static void sync_filesystems(int wait)
+void sync_filesystems(int wait)
{
iterate_supers(sync_one_sb, &wait);
}
@@ -165,6 +169,12 @@ SYSCALL_DEFINE1(syncfs, int, fd)
*/
int vfs_fsync_range(struct file *file, loff_t start, loff_t end, int datasync)
{
+#ifdef CONFIG_DYNAMIC_FSYNC
+ if (!early_suspend_active)
+ return 0;
+ else {
+#endif
+
struct address_space *mapping = file->f_mapping;
int err, ret;
@@ -187,6 +197,9 @@ int vfs_fsync_range(struct file *file, l
out:
return ret;
+#ifdef CONFIG_DYNAMIC_FSYNC
+ }
+#endif
}
EXPORT_SYMBOL(vfs_fsync_range);
@@ -208,22 +221,33 @@ static int do_fsync(unsigned int fd, int
{
struct file *file;
int ret = -EBADF;
+ int fput_needed;
- file = fget(fd);
+ file = fget_light(fd, &fput_needed);
if (file) {
ret = vfs_fsync(file, datasync);
- fput(file);
+ fput_light(file, fput_needed);
}
return ret;
}
SYSCALL_DEFINE1(fsync, unsigned int, fd)
{
+#ifdef CONFIG_DYNAMIC_FSYNC
+ if (!early_suspend_active)
+ return 0;
+ else
+#endif
return do_fsync(fd, 0);
}
SYSCALL_DEFINE1(fdatasync, unsigned int, fd)
{
+#ifdef CONFIG_DYNAMIC_FSYNC
+ if (!early_suspend_active)
+ return 0;
+ else
+#endif
return do_fsync(fd, 1);
}
@@ -294,6 +318,12 @@ EXPORT_SYMBOL(generic_write_sync);
SYSCALL_DEFINE(sync_file_range)(int fd, loff_t offset, loff_t nbytes,
unsigned int flags)
{
+#ifdef CONFIG_DYNAMIC_FSYNC
+ if (!early_suspend_active)
+ return 0;
+ else {
+#endif
+
int ret;
struct file *file;
struct address_space *mapping;
@@ -373,6 +403,9 @@ out_put:
fput_light(file, fput_needed);
out:
return ret;
+#ifdef CONFIG_DYNAMIC_FSYNC
+ }
+#endif
}
#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
asmlinkage long SyS_sync_file_range(long fd, loff_t offset, loff_t nbytes,
@@ -389,6 +422,11 @@ SYSCALL_ALIAS(sys_sync_file_range, SyS_s
SYSCALL_DEFINE(sync_file_range2)(int fd, unsigned int flags,
loff_t offset, loff_t nbytes)
{
+#ifdef CONFIG_DYNAMIC_FSYNC
+ if (!early_suspend_active)
+ return 0;
+ else
+#endif
return sys_sync_file_range(fd, offset, nbytes, flags);
}
#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS