ubifs: Add printf debugging to see where we have the error in mounting

This commit is contained in:
Holger Hans Peter Freyther 2013-01-14 19:26:08 +01:00
parent 6d8f8e005e
commit 85323309ed
1 changed files with 24 additions and 0 deletions

View File

@ -586,18 +586,22 @@ static int mount_ubifs(struct ubifs_info *c)
long long x;
size_t sz;
printf("%d: Init Constants\n", __LINE__);
err = init_constants_early(c);
if (err)
return err;
printf("%d: Debugging init\n", __LINE__);
err = ubifs_debugging_init(c);
if (err)
return err;
printf("%d: Check volume\n", __LINE__);
err = check_volume_empty(c);
if (err)
goto out_free;
printf("%d: Empty?\n", __LINE__);
if (c->empty && (mounted_read_only || c->ro_media)) {
/*
* This UBI volume is empty, and read-only, or the file system
@ -609,6 +613,7 @@ static int mount_ubifs(struct ubifs_info *c)
goto out_free;
}
printf("%d: Empty?\n", __LINE__);
if (c->ro_media && !mounted_read_only) {
ubifs_err("cannot mount read-write - read-only media");
err = -EROFS;
@ -621,10 +626,12 @@ static int mount_ubifs(struct ubifs_info *c)
* never exceed 64.
*/
err = -ENOMEM;
printf("%d: Alloc?\n", __LINE__);
c->bottom_up_buf = kmalloc(BOTTOM_UP_HEIGHT * sizeof(int), GFP_KERNEL);
if (!c->bottom_up_buf)
goto out_free;
printf("%d: Alloc?\n", __LINE__);
c->sbuf = vmalloc(c->leb_size);
if (!c->sbuf)
goto out_free;
@ -635,6 +642,7 @@ static int mount_ubifs(struct ubifs_info *c)
*/
c->always_chk_crc = 1;
printf("%d: Read SB?\n", __LINE__);
err = ubifs_read_superblock(c);
if (err)
goto out_free;
@ -643,18 +651,22 @@ static int mount_ubifs(struct ubifs_info *c)
* Make sure the compressor which is set as default in the superblock
* or overridden by mount options is actually compiled in.
*/
printf("%d: Compr?\n", __LINE__);
if (!ubifs_compr_present(c->default_compr)) {
ubifs_err("'compressor \"%s\" is not compiled in",
ubifs_compr_name(c->default_compr));
goto out_free;
}
printf("%d: init?\n", __LINE__);
dbg_failure_mode_registration(c);
printf("%d: init?\n", __LINE__);
err = init_constants_sb(c);
if (err)
goto out_free;
printf("%d: alloc?\n", __LINE__);
sz = ALIGN(c->max_idx_node_sz, c->min_io_size);
sz = ALIGN(sz + c->max_idx_node_sz, c->min_io_size);
c->cbuf = kmalloc(sz, GFP_NOFS);
@ -663,12 +675,15 @@ static int mount_ubifs(struct ubifs_info *c)
goto out_free;
}
printf("%d: read master?\n", __LINE__);
sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id);
err = ubifs_read_master(c);
if (err)
goto out_master;
printf("%d: read master?\n", __LINE__);
sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id);
init_constants_master(c);
if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) {
@ -676,22 +691,28 @@ static int mount_ubifs(struct ubifs_info *c)
c->need_recovery = 1;
}
printf("%d: lpt?\n", __LINE__);
sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id);
err = ubifs_lpt_init(c, 1, !mounted_read_only);
if (err)
goto out_lpt;
printf("%d: idx?\n", __LINE__);
err = dbg_check_idx_size(c, c->old_idx_sz);
if (err)
goto out_lpt;
printf("%d: journal?\n", __LINE__);
err = ubifs_replay_journal(c);
if (err)
goto out_journal;
printf("%d: orphans?\n", __LINE__);
err = ubifs_mount_orphans(c, c->need_recovery, mounted_read_only);
if (err)
goto out_orphans;
printf("%d: recovery %d?\n", __LINE__, c->need_recovery);
if (c->need_recovery) {
err = ubifs_recover_size(c);
if (err)
@ -702,6 +723,7 @@ static int mount_ubifs(struct ubifs_info *c)
list_add_tail(&c->infos_list, &ubifs_infos);
spin_unlock(&ubifs_infos_lock);
printf("%d: recovery %d?\n", __LINE__, c->need_recovery);
if (c->need_recovery) {
if (mounted_read_only)
ubifs_msg("recovery deferred");
@ -711,6 +733,7 @@ static int mount_ubifs(struct ubifs_info *c)
}
}
printf("%d: check\n", __LINE__);
err = dbg_check_filesystem(c);
if (err)
goto out_infos;
@ -812,6 +835,7 @@ out_free:
vfree(c->sbuf);
kfree(c->bottom_up_buf);
ubifs_debugging_exit(c);
printf("SOME ERROR\n");
return err;
}