提交 26d05777 编写于 作者: A Artem Bityutskiy

UBIFS: always commit on unmount

UBIFS commits on unmount to make the next mount faster. Currently,
it commits only if there is more than LEB size bytes in the
journal. This is not very good, because journal size may be
large (512KiB). And there may be few deletions in the journal
which do not take much journal space, but which do introduce
a lot of TNC changes and make mount slow.

Thus, jurt remove this condition and always commit.
Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
上级 cb5c6a2b
...@@ -1570,20 +1570,24 @@ static int ubifs_remount_rw(struct ubifs_info *c) ...@@ -1570,20 +1570,24 @@ static int ubifs_remount_rw(struct ubifs_info *c)
* @c: UBIFS file-system description object * @c: UBIFS file-system description object
* *
* This function is called during un-mounting and re-mounting, and it commits * This function is called during un-mounting and re-mounting, and it commits
* the journal unless the "fast unmount" mode is enabled. It also avoids * the journal unless the "fast unmount" mode is enabled.
* committing the journal if it contains too few data.
*/ */
static void commit_on_unmount(struct ubifs_info *c) static void commit_on_unmount(struct ubifs_info *c)
{ {
if (!c->fast_unmount) { struct super_block *sb = c->vfs_sb;
long long bud_bytes; long long bud_bytes;
spin_lock(&c->buds_lock); /*
bud_bytes = c->bud_bytes; * This function is called before the background thread is stopped, so
spin_unlock(&c->buds_lock); * we may race with ongoing commit, which means we have to take
if (bud_bytes > c->leb_size) * @c->bud_lock to access @c->bud_bytes.
ubifs_run_commit(c); */
} spin_lock(&c->buds_lock);
bud_bytes = c->bud_bytes;
spin_unlock(&c->buds_lock);
if (!c->fast_unmount && !(sb->s_flags & MS_RDONLY) && bud_bytes)
ubifs_run_commit(c);
} }
/** /**
...@@ -2009,7 +2013,7 @@ static void ubifs_kill_sb(struct super_block *sb) ...@@ -2009,7 +2013,7 @@ static void ubifs_kill_sb(struct super_block *sb)
* We do 'commit_on_unmount()' here instead of 'ubifs_put_super()' * We do 'commit_on_unmount()' here instead of 'ubifs_put_super()'
* in order to be outside BKL. * in order to be outside BKL.
*/ */
if (sb->s_root && !(sb->s_flags & MS_RDONLY)) if (sb->s_root)
commit_on_unmount(c); commit_on_unmount(c);
/* The un-mount routine is actually done in put_super() */ /* The un-mount routine is actually done in put_super() */
generic_shutdown_super(sb); generic_shutdown_super(sb);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册