]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
UBIFS: commit on sync_fs
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tue, 9 Sep 2008 09:31:37 +0000 (12:31 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tue, 30 Sep 2008 08:12:58 +0000 (11:12 +0300)
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>
fs/ubifs/super.c

index dae1c62156c6e86163be7f9027ea7d1b8dbfabb2..7e1f3efdf632d691711c2425e7009ecbb83d3ea8 100644 (file)
@@ -418,6 +418,7 @@ static int ubifs_sync_fs(struct super_block *sb, int wait)
 {
        struct ubifs_info *c = sb->s_fs_info;
        int i, ret = 0, err;
+       long long bud_bytes;
 
        if (c->jheads)
                for (i = 0; i < c->jhead_cnt; i++) {
@@ -425,6 +426,17 @@ static int ubifs_sync_fs(struct super_block *sb, int wait)
                        if (err && !ret)
                                ret = err;
                }
+
+       /* Commit the journal unless it has too few data */
+       spin_lock(&c->buds_lock);
+       bud_bytes = c->bud_bytes;
+       spin_unlock(&c->buds_lock);
+       if (bud_bytes > c->leb_size) {
+               err = ubifs_run_commit(c);
+               if (err)
+                       return err;
+       }
+
        /*
         * We ought to call sync for c->ubi but it does not have one. If it had
         * it would in turn call mtd->sync, however mtd operations are