diff options
| author | Paul Reioux <reioux@gmail.com> | 2015-03-29 14:52:41 -0400 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2016-08-26 16:09:52 +0200 |
| commit | d2cdb4e1ce3df4e28b0e51807455ddf424ff2e71 (patch) | |
| tree | 6d71460d5c5f1da06e3c94aa317af430fdecefba /fs/sync.c | |
| parent | 595adec881c2eaead1bd81ce21864407f50b136e (diff) | |
Dynamic Fsync Control
Diffstat (limited to 'fs/sync.c')
| -rw-r--r-- | fs/sync.c | 48 |
1 files changed, 48 insertions, 0 deletions
@@ -17,6 +17,11 @@ #include <linux/backing-dev.h> #include "internal.h" +#ifdef CONFIG_DYNAMIC_FSYNC +extern bool early_suspend_active; +extern bool dyn_fsync_active; +#endif + #define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \ SYNC_FILE_RANGE_WAIT_AFTER) @@ -89,6 +94,17 @@ static void fdatawait_one_bdev(struct block_device *bdev, void *arg) filemap_fdatawait(bdev->bd_inode->i_mapping); } +#ifndef CONFIG_DYNAMIC_FSYNC +static +#endif +void sync_filesystems(int wait) +{ + iterate_supers(sync_fs_one_sb, &wait); +} +#ifdef CONFIG_DYNAMIC_FSYNC +EXPORT_SYMBOL_GPL(sync_filesystems); +#endif + /* * Sync everything. We start by waking flusher threads so that most of * writeback runs on all devices in parallel. Then we sync all inodes reliably @@ -193,7 +209,15 @@ EXPORT_SYMBOL(vfs_fsync_range); */ int vfs_fsync(struct file *file, int datasync) { +#ifdef CONFIG_DYNAMIC_FSYNC + if (likely(dyn_fsync_active && !early_suspend_active)) + return 0; + else { +#endif return vfs_fsync_range(file, 0, LLONG_MAX, datasync); +#ifdef CONFIG_DYNAMIC_FSYNC + } +#endif } EXPORT_SYMBOL(vfs_fsync); @@ -211,11 +235,21 @@ static int do_fsync(unsigned int fd, int datasync) SYSCALL_DEFINE1(fsync, unsigned int, fd) { +#ifdef CONFIG_DYNAMIC_FSYNC + if (likely(dyn_fsync_active && !early_suspend_active)) + return 0; + else +#endif return do_fsync(fd, 0); } SYSCALL_DEFINE1(fdatasync, unsigned int, fd) { +#if 0 + if (likely(dyn_fsync_active && !early_suspend_active)) + return 0; + else +#endif return do_fsync(fd, 1); } @@ -286,6 +320,12 @@ EXPORT_SYMBOL(generic_write_sync); SYSCALL_DEFINE4(sync_file_range, int, fd, loff_t, offset, loff_t, nbytes, unsigned int, flags) { +#ifdef CONFIG_DYNAMIC_FSYNC +if (likely(dyn_fsync_active && !early_suspend_active)) +return 0; +else { +#endif + int ret; struct fd f; struct address_space *mapping; @@ -364,6 +404,9 @@ out_put: fdput(f); out: return ret; +#ifdef CONFIG_DYNAMIC_FSYNC + } +#endif } /* It would be nice if people remember that not all the world's an i386 @@ -371,5 +414,10 @@ out: SYSCALL_DEFINE4(sync_file_range2, int, fd, unsigned int, flags, loff_t, offset, loff_t, nbytes) { +#ifdef CONFIG_DYNAMIC_FSYNC + if (likely(dyn_fsync_active && !early_suspend_active)) + return 0; + else +#endif return sys_sync_file_range(fd, offset, nbytes, flags); } |
