diff options
Diffstat (limited to 'fs/sync.c')
-rw-r--r-- | fs/sync.c | 31 |
1 files changed, 10 insertions, 21 deletions
@@ -18,35 +18,24 @@ | |||
18 | #define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \ | 18 | #define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \ |
19 | SYNC_FILE_RANGE_WAIT_AFTER) | 19 | SYNC_FILE_RANGE_WAIT_AFTER) |
20 | 20 | ||
21 | /* | 21 | SYSCALL_DEFINE0(sync) |
22 | * sync everything. Start out by waking pdflush, because that writes back | ||
23 | * all queues in parallel. | ||
24 | */ | ||
25 | static void do_sync(unsigned long wait) | ||
26 | { | 22 | { |
27 | wakeup_pdflush(0); | 23 | sync_filesystems(0); |
28 | sync_inodes(0); /* All mappings, inodes and their blockdevs */ | 24 | sync_filesystems(1); |
29 | vfs_dq_sync(NULL); | ||
30 | sync_inodes(wait); /* Mappings, inodes and blockdevs, again. */ | ||
31 | sync_supers(); /* Write the superblocks */ | ||
32 | sync_filesystems(0); /* Start syncing the filesystems */ | ||
33 | sync_filesystems(wait); /* Waitingly sync the filesystems */ | ||
34 | sync_blockdevs(); | ||
35 | if (!wait) | ||
36 | printk("Emergency Sync complete\n"); | ||
37 | if (unlikely(laptop_mode)) | 25 | if (unlikely(laptop_mode)) |
38 | laptop_sync_completion(); | 26 | laptop_sync_completion(); |
39 | } | ||
40 | |||
41 | SYSCALL_DEFINE0(sync) | ||
42 | { | ||
43 | do_sync(1); | ||
44 | return 0; | 27 | return 0; |
45 | } | 28 | } |
46 | 29 | ||
47 | static void do_sync_work(struct work_struct *work) | 30 | static void do_sync_work(struct work_struct *work) |
48 | { | 31 | { |
49 | do_sync(0); | 32 | /* |
33 | * Sync twice to reduce the possibility we skipped some inodes / pages | ||
34 | * because they were temporarily locked | ||
35 | */ | ||
36 | sync_filesystems(0); | ||
37 | sync_filesystems(0); | ||
38 | printk("Emergency Sync complete\n"); | ||
50 | kfree(work); | 39 | kfree(work); |
51 | } | 40 | } |
52 | 41 | ||