diff options
author | Matthew L. Creech <mlcreech@gmail.com> | 2011-05-06 18:58:23 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-16 07:12:15 -0400 |
commit | 9d510db423303b4f3555074dd7bdd0d692e432a4 (patch) | |
tree | e05516d94fe62492e41b7ccc219db8abfe1c6ab8 | |
parent | 6554a6578131a217d4ea6d779a62f120081a2e8b (diff) |
UBIFS: fix-up free space on mount if flag is set
If a UBIFS filesystem is being mounted read-write, or is being remounted
from read-only to read-write, check for the "space_fixup" flag and fix
all LEBs containing empty space if necessary.
Artem: tweaked the patch a bit
Signed-off-by: Matthew L. Creech <mlcreech@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r-- | fs/ubifs/super.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 575ea8353d08..6db0bdaa9f74 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -1396,6 +1396,12 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1396 | } else | 1396 | } else |
1397 | ubifs_assert(c->lst.taken_empty_lebs > 0); | 1397 | ubifs_assert(c->lst.taken_empty_lebs > 0); |
1398 | 1398 | ||
1399 | if (!c->ro_mount && c->space_fixup) { | ||
1400 | err = ubifs_fixup_free_space(c); | ||
1401 | if (err) | ||
1402 | goto out_infos; | ||
1403 | } | ||
1404 | |||
1399 | err = dbg_check_filesystem(c); | 1405 | err = dbg_check_filesystem(c); |
1400 | if (err) | 1406 | if (err) |
1401 | goto out_infos; | 1407 | goto out_infos; |
@@ -1686,6 +1692,13 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1686 | */ | 1692 | */ |
1687 | err = dbg_check_space_info(c); | 1693 | err = dbg_check_space_info(c); |
1688 | } | 1694 | } |
1695 | |||
1696 | if (c->space_fixup) { | ||
1697 | err = ubifs_fixup_free_space(c); | ||
1698 | if (err) | ||
1699 | goto out; | ||
1700 | } | ||
1701 | |||
1689 | mutex_unlock(&c->umount_mutex); | 1702 | mutex_unlock(&c->umount_mutex); |
1690 | return err; | 1703 | return err; |
1691 | 1704 | ||