aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/super.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-09-09 05:31:37 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-09-30 04:12:58 -0400
commit403e12ab30ab160e1015bd998f0abc1865c574e0 (patch)
tree1682251f2a37d3a8df6b17646cba30e44e243d37 /fs/ubifs/super.c
parentaf2eb5637b88f7b8edf295ad3880706c5c30c324 (diff)
UBIFS: commit on sync_fs
Commit the journal when the FS is sync'ed. This will make statfs provide better free space report. And we anyway advice our users to sync the FS if they want better statfs report. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r--fs/ubifs/super.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index dae1c62156c6..7e1f3efdf632 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -418,6 +418,7 @@ static int ubifs_sync_fs(struct super_block *sb, int wait)
418{ 418{
419 struct ubifs_info *c = sb->s_fs_info; 419 struct ubifs_info *c = sb->s_fs_info;
420 int i, ret = 0, err; 420 int i, ret = 0, err;
421 long long bud_bytes;
421 422
422 if (c->jheads) 423 if (c->jheads)
423 for (i = 0; i < c->jhead_cnt; i++) { 424 for (i = 0; i < c->jhead_cnt; i++) {
@@ -425,6 +426,17 @@ static int ubifs_sync_fs(struct super_block *sb, int wait)
425 if (err && !ret) 426 if (err && !ret)
426 ret = err; 427 ret = err;
427 } 428 }
429
430 /* Commit the journal unless it has too few data */
431 spin_lock(&c->buds_lock);
432 bud_bytes = c->bud_bytes;
433 spin_unlock(&c->buds_lock);
434 if (bud_bytes > c->leb_size) {
435 err = ubifs_run_commit(c);
436 if (err)
437 return err;
438 }
439
428 /* 440 /*
429 * We ought to call sync for c->ubi but it does not have one. If it had 441 * We ought to call sync for c->ubi but it does not have one. If it had
430 * it would in turn call mtd->sync, however mtd operations are 442 * it would in turn call mtd->sync, however mtd operations are