| 91 | } |
| 92 | |
| 93 | INT |
| 94 | Ext2RecoverJournal( |
| 95 | PEXT2_IRP_CONTEXT IrpContext, |
| 96 | PEXT2_VCB Vcb |
| 97 | ) |
| 98 | { |
| 99 | INT rc = 0; |
| 100 | ULONG jNo = 0; |
| 101 | PEXT2_MCB jcb = NULL; |
| 102 | struct block_device * bd = &Vcb->bd; |
| 103 | struct super_block * sb = &Vcb->sb; |
| 104 | struct inode * ji = NULL; |
| 105 | journal_t * journal = NULL; |
| 106 | struct ext3_super_block *esb; |
| 107 | |
| 108 | ExAcquireResourceExclusiveLite(&Vcb->MainResource, TRUE); |
| 109 | |
| 110 | /* check journal inode number */ |
| 111 | if (!Ext2CheckJournal(Vcb, &jNo)) { |
| 112 | rc = -1; |
| 113 | goto errorout; |
| 114 | } |
| 115 | |
| 116 | /* allocate journal Mcb */ |
| 117 | jcb = Ext2LoadInternalJournal(Vcb, jNo); |
| 118 | if (!jcb) { |
| 119 | rc = -6; |
| 120 | goto errorout; |
| 121 | } |
| 122 | |
| 123 | /* allocate journal inode */ |
| 124 | ji = &jcb->Inode; |
| 125 | |
| 126 | /* initialize journal file from inode */ |
| 127 | journal = jbd2_journal_init_inode(ji); |
| 128 | |
| 129 | /* initialzation succeeds ? */ |
| 130 | if (!journal) { |
| 131 | DEBUG(DL_ERR, ( "jbd2_journal_init_inode failed\n")); |
| 132 | iput(ji); |
| 133 | rc = -8; |
| 134 | goto errorout; |
| 135 | } |
| 136 | |
| 137 | if (ext4_has_feature_journal_needs_recovery(sb)) { |
| 138 | /* loading the journal will do a recover */ |
| 139 | rc = jbd2_journal_load(journal); |
| 140 | |
| 141 | if (0 != rc) { |
| 142 | DEBUG(DL_ERR, ( "Ext2Fsd: recover_journal: failed " |
| 143 | "to recover journal data. rc=%d\n", rc)); |
| 144 | rc = -9; |
| 145 | //goto errorout; |
| 146 | } |
| 147 | |
| 148 | /* reload super_block and group_description */ |
| 149 | Ext2RefreshSuper(IrpContext, Vcb); |
| 150 | Ext2RefreshGroup(IrpContext, Vcb); |
no test coverage detected