Skip to content

Commit

Permalink
UBIFS: fix-up free space on mount if flag is set
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matthew L. Creech authored and Artem Bityutskiy committed May 16, 2011
1 parent 6554a65 commit 9d510db
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions fs/ubifs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 9d510db

Please sign in to comment.