diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-01-09 14:02:37 -0500 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-01-18 07:04:57 -0500 |
commit | dedb0d48a9d4d57086526b94a4b64da789a646e4 (patch) | |
tree | 4771fbc7593b606bc9e88941590a7b4f0b480d82 /fs/ubifs/super.c | |
parent | 1de9e8e70f5acc441550ca75433563d91b269bbe (diff) |
UBIFS: do not commit twice
VFS calls '->sync_fs()' twice - first time with @wait = 0, second
time with @wait = 1. As a result, we may commit and synchronize
write-buffers twice. Avoid doing this by returning immediatelly if
@wait = 0.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r-- | fs/ubifs/super.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 89556ee72518..a7fc97f4d9de 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -432,18 +432,19 @@ static int ubifs_sync_fs(struct super_block *sb, int wait) | |||
432 | int i, err; | 432 | int i, err; |
433 | struct ubifs_info *c = sb->s_fs_info; | 433 | struct ubifs_info *c = sb->s_fs_info; |
434 | struct writeback_control wbc = { | 434 | struct writeback_control wbc = { |
435 | .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_NONE, | 435 | .sync_mode = WB_SYNC_ALL, |
436 | .range_start = 0, | 436 | .range_start = 0, |
437 | .range_end = LLONG_MAX, | 437 | .range_end = LLONG_MAX, |
438 | .nr_to_write = LONG_MAX, | 438 | .nr_to_write = LONG_MAX, |
439 | }; | 439 | }; |
440 | 440 | ||
441 | /* | 441 | /* |
442 | * Note by akpm about WB_SYNC_NONE used above: zero @wait is just an | 442 | * Zero @wait is just an advisory thing to help the file system shove |
443 | * advisory thing to help the file system shove lots of data into the | 443 | * lots of data into the queues, and there will be the second |
444 | * queues. If some gets missed then it'll be picked up on the second | ||
445 | * '->sync_fs()' call, with non-zero @wait. | 444 | * '->sync_fs()' call, with non-zero @wait. |
446 | */ | 445 | */ |
446 | if (!wait) | ||
447 | return 0; | ||
447 | 448 | ||
448 | if (sb->s_flags & MS_RDONLY) | 449 | if (sb->s_flags & MS_RDONLY) |
449 | return 0; | 450 | return 0; |