aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ubifs/super.c')
-rw-r--r--fs/ubifs/super.c50
1 files changed, 5 insertions, 45 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index ab85eb8cce79..1182b66a5491 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -957,13 +957,16 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
957 957
958 token = match_token(p, tokens, args); 958 token = match_token(p, tokens, args);
959 switch (token) { 959 switch (token) {
960 /*
961 * %Opt_fast_unmount and %Opt_norm_unmount options are ignored.
962 * We accepte them in order to be backware-compatible. But this
963 * should be removed at some point.
964 */
960 case Opt_fast_unmount: 965 case Opt_fast_unmount:
961 c->mount_opts.unmount_mode = 2; 966 c->mount_opts.unmount_mode = 2;
962 c->fast_unmount = 1;
963 break; 967 break;
964 case Opt_norm_unmount: 968 case Opt_norm_unmount:
965 c->mount_opts.unmount_mode = 1; 969 c->mount_opts.unmount_mode = 1;
966 c->fast_unmount = 0;
967 break; 970 break;
968 case Opt_bulk_read: 971 case Opt_bulk_read:
969 c->mount_opts.bulk_read = 2; 972 c->mount_opts.bulk_read = 2;
@@ -1359,7 +1362,6 @@ static int mount_ubifs(struct ubifs_info *c)
1359 c->uuid[4], c->uuid[5], c->uuid[6], c->uuid[7], 1362 c->uuid[4], c->uuid[5], c->uuid[6], c->uuid[7],
1360 c->uuid[8], c->uuid[9], c->uuid[10], c->uuid[11], 1363 c->uuid[8], c->uuid[9], c->uuid[10], c->uuid[11],
1361 c->uuid[12], c->uuid[13], c->uuid[14], c->uuid[15]); 1364 c->uuid[12], c->uuid[13], c->uuid[14], c->uuid[15]);
1362 dbg_msg("fast unmount: %d", c->fast_unmount);
1363 dbg_msg("big_lpt %d", c->big_lpt); 1365 dbg_msg("big_lpt %d", c->big_lpt);
1364 dbg_msg("log LEBs: %d (%d - %d)", 1366 dbg_msg("log LEBs: %d (%d - %d)",
1365 c->log_lebs, UBIFS_LOG_LNUM, c->log_last); 1367 c->log_lebs, UBIFS_LOG_LNUM, c->log_last);
@@ -1616,38 +1618,6 @@ out:
1616} 1618}
1617 1619
1618/** 1620/**
1619 * commit_on_unmount - commit the journal when un-mounting.
1620 * @c: UBIFS file-system description object
1621 *
1622 * This function is called during un-mounting and re-mounting, and it commits
1623 * the journal unless the "fast unmount" mode is enabled.
1624 */
1625static void commit_on_unmount(struct ubifs_info *c)
1626{
1627 long long bud_bytes;
1628
1629 if (!c->fast_unmount) {
1630 dbg_gen("skip committing - fast unmount enabled");
1631 return;
1632 }
1633
1634 /*
1635 * This function is called before the background thread is stopped, so
1636 * we may race with ongoing commit, which means we have to take
1637 * @c->bud_lock to access @c->bud_bytes.
1638 */
1639 spin_lock(&c->buds_lock);
1640 bud_bytes = c->bud_bytes;
1641 spin_unlock(&c->buds_lock);
1642
1643 if (bud_bytes) {
1644 dbg_gen("run commit");
1645 ubifs_run_commit(c);
1646 } else
1647 dbg_gen("journal is empty, do not run commit");
1648}
1649
1650/**
1651 * ubifs_remount_ro - re-mount in read-only mode. 1621 * ubifs_remount_ro - re-mount in read-only mode.
1652 * @c: UBIFS file-system description object 1622 * @c: UBIFS file-system description object
1653 * 1623 *
@@ -1661,7 +1631,6 @@ static void ubifs_remount_ro(struct ubifs_info *c)
1661 ubifs_assert(!c->need_recovery); 1631 ubifs_assert(!c->need_recovery);
1662 ubifs_assert(!(c->vfs_sb->s_flags & MS_RDONLY)); 1632 ubifs_assert(!(c->vfs_sb->s_flags & MS_RDONLY));
1663 1633
1664 commit_on_unmount(c);
1665 mutex_lock(&c->umount_mutex); 1634 mutex_lock(&c->umount_mutex);
1666 if (c->bgt) { 1635 if (c->bgt) {
1667 kthread_stop(c->bgt); 1636 kthread_stop(c->bgt);
@@ -2077,15 +2046,6 @@ out_close:
2077 2046
2078static void ubifs_kill_sb(struct super_block *sb) 2047static void ubifs_kill_sb(struct super_block *sb)
2079{ 2048{
2080 struct ubifs_info *c = sb->s_fs_info;
2081
2082 /*
2083 * We do 'commit_on_unmount()' here instead of 'ubifs_put_super()'
2084 * in order to be outside BKL.
2085 */
2086 if (sb->s_root && !(sb->s_flags & MS_RDONLY))
2087 commit_on_unmount(c);
2088 /* The un-mount routine is actually done in put_super() */
2089 generic_shutdown_super(sb); 2049 generic_shutdown_super(sb);
2090} 2050}
2091 2051