diff options
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/super.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 13097830e8bc..471301799c52 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/seq_file.h> | 35 | #include <linux/seq_file.h> |
36 | #include <linux/mount.h> | 36 | #include <linux/mount.h> |
37 | #include <linux/math64.h> | 37 | #include <linux/math64.h> |
38 | #include <linux/writeback.h> | ||
38 | #include "ubifs.h" | 39 | #include "ubifs.h" |
39 | 40 | ||
40 | /* | 41 | /* |
@@ -431,6 +432,23 @@ static int ubifs_sync_fs(struct super_block *sb, int wait) | |||
431 | struct ubifs_info *c = sb->s_fs_info; | 432 | struct ubifs_info *c = sb->s_fs_info; |
432 | int i, ret = 0, err; | 433 | int i, ret = 0, err; |
433 | long long bud_bytes; | 434 | long long bud_bytes; |
435 | struct writeback_control wbc = { | ||
436 | .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_HOLD, | ||
437 | .range_start = 0, | ||
438 | .range_end = LLONG_MAX, | ||
439 | .nr_to_write = LONG_MAX, | ||
440 | }; | ||
441 | |||
442 | /* | ||
443 | * VFS calls '->sync_fs()' before synchronizing all dirty inodes and | ||
444 | * pages, so synchronize them first, then commit the journal. Strictly | ||
445 | * speaking, it is not necessary to commit the journal here, | ||
446 | * synchronizing write-buffers would be enough. But committing makes | ||
447 | * UBIFS free space predictions much more accurate, so we want to let | ||
448 | * the user be able to get more accurate results of 'statfs()' after | ||
449 | * they synchronize the file system. | ||
450 | */ | ||
451 | generic_sync_sb_inodes(sb, &wbc); | ||
434 | 452 | ||
435 | if (c->jheads) { | 453 | if (c->jheads) { |
436 | for (i = 0; i < c->jhead_cnt; i++) { | 454 | for (i = 0; i < c->jhead_cnt; i++) { |