aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Gardiner <bengardiner@nanometrics.ca>2011-05-30 14:56:15 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-06-03 11:12:31 -0400
commit781c5717a95a74b294beb38b8276943b0f8b5bb4 (patch)
treeed8dfe3b7066e6d0854e381f46712c7280b2f05e
parent4f1ab9b01d34eac9fc958f7150d3bf266dcc1685 (diff)
UBIFS: intialize LPT earlier
The current 'mount_ubifs()' implementation does not initialize the LPT until the the master node is marked dirty. Move the LPT initialization to before marking the master node dirty. This is a preparation for the next patch which will move the free-space-fixup check to before marking the master node dirty, because we have to fix-up the free space before doing any writes. Artem: massaged the patch and commit message. Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Reviewed-by: Matthew L. Creech <mlcreech@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r--fs/ubifs/super.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 1e40db740da9..6d357fd9c289 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1282,17 +1282,24 @@ static int mount_ubifs(struct ubifs_info *c)
1282 if (err) 1282 if (err)
1283 goto out_master; 1283 goto out_master;
1284 1284
1285 init_constants_master(c);
1286
1287 if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) { 1285 if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) {
1288 ubifs_msg("recovery needed"); 1286 ubifs_msg("recovery needed");
1289 c->need_recovery = 1; 1287 c->need_recovery = 1;
1290 if (!c->ro_mount) { 1288 }
1291 err = ubifs_recover_inl_heads(c, c->sbuf); 1289
1292 if (err) 1290 init_constants_master(c);
1293 goto out_master; 1291
1294 } 1292 if (c->need_recovery && !c->ro_mount) {
1295 } else if (!c->ro_mount) { 1293 err = ubifs_recover_inl_heads(c, c->sbuf);
1294 if (err)
1295 goto out_master;
1296 }
1297
1298 err = ubifs_lpt_init(c, 1, !c->ro_mount);
1299 if (err)
1300 goto out_master;
1301
1302 if (!c->ro_mount) {
1296 /* 1303 /*
1297 * Set the "dirty" flag so that if we reboot uncleanly we 1304 * Set the "dirty" flag so that if we reboot uncleanly we
1298 * will notice this immediately on the next mount. 1305 * will notice this immediately on the next mount.
@@ -1300,13 +1307,9 @@ static int mount_ubifs(struct ubifs_info *c)
1300 c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY); 1307 c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY);
1301 err = ubifs_write_master(c); 1308 err = ubifs_write_master(c);
1302 if (err) 1309 if (err)
1303 goto out_master; 1310 goto out_lpt;
1304 } 1311 }
1305 1312
1306 err = ubifs_lpt_init(c, 1, !c->ro_mount);
1307 if (err)
1308 goto out_lpt;
1309
1310 err = dbg_check_idx_size(c, c->bi.old_idx_sz); 1313 err = dbg_check_idx_size(c, c->bi.old_idx_sz);
1311 if (err) 1314 if (err)
1312 goto out_lpt; 1315 goto out_lpt;