[PATCH 2/3] UBIFS: intialize the LPT earlier

From: Ben Gardiner
Date: Mon May 30 2011 - 14:56:44 EST


The current mount_ubifs() implementation does not initialize the LPT until the
check for recovery is completed and the dirty flag is written.

Move the LPT initializtion to before the check for recovery and dirty flag in
preparation for the next patch which will move the free-space-fixup check to
directly after this allocation.

Signed-off-by: Ben Gardiner <bengardiner@xxxxxxxxxxxxxx>

---
fs/ubifs/super.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 6db0bdaa..89c8d33 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1281,13 +1281,17 @@ static int mount_ubifs(struct ubifs_info *c)

init_constants_master(c);

+ err = ubifs_lpt_init(c, 1, !c->ro_mount);
+ if (err)
+ goto out_lpt;
+
if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) {
ubifs_msg("recovery needed");
c->need_recovery = 1;
if (!c->ro_mount) {
err = ubifs_recover_inl_heads(c, c->sbuf);
if (err)
- goto out_master;
+ goto out_lpt;
}
} else if (!c->ro_mount) {
/*
@@ -1297,13 +1301,9 @@ static int mount_ubifs(struct ubifs_info *c)
c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY);
err = ubifs_write_master(c);
if (err)
- goto out_master;
+ goto out_lpt;
}

- err = ubifs_lpt_init(c, 1, !c->ro_mount);
- if (err)
- goto out_lpt;
-
err = dbg_check_idx_size(c, c->bi.old_idx_sz);
if (err)
goto out_lpt;
--
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/