summaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorMatthew L. Creech <mlcreech@gmail.com>2011-05-06 18:58:23 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-16 14:12:15 +0300
commit9d510db423303b4f3555074dd7bdd0d692e432a4 (patch)
treee05516d94fe62492e41b7ccc219db8abfe1c6ab8 /fs/ubifs
parent6554a6578131a217d4ea6d779a62f120081a2e8b (diff)
downloadlinux-9d510db423303b4f3555074dd7bdd0d692e432a4.tar.gz
linux-9d510db423303b4f3555074dd7bdd0d692e432a4.tar.bz2
linux-9d510db423303b4f3555074dd7bdd0d692e432a4.zip
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>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/super.c13
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)
} else
ubifs_assert(c->lst.taken_empty_lebs > 0);
+ if (!c->ro_mount && c->space_fixup) {
+ err = ubifs_fixup_free_space(c);
+ if (err)
+ goto out_infos;
+ }
+
err = dbg_check_filesystem(c);
if (err)
goto out_infos;
@@ -1686,6 +1692,13 @@ static int ubifs_remount_rw(struct ubifs_info *c)
*/
err = dbg_check_space_info(c);
}
+
+ if (c->space_fixup) {
+ err = ubifs_fixup_free_space(c);
+ if (err)
+ goto out;
+ }
+
mutex_unlock(&c->umount_mutex);
return err;