MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2RecoverJournal

Function Ext2RecoverJournal

Ext4Fsd/ext3/recover.c:93–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93INT
94Ext2RecoverJournal(
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);

Callers 2

Ext2InitializeVcbFunction · 0.85

Calls 12

Ext2CheckJournalFunction · 0.85
Ext2LoadInternalJournalFunction · 0.85
jbd2_journal_init_inodeFunction · 0.85
iputFunction · 0.85
jbd2_journal_loadFunction · 0.85
Ext2RefreshSuperFunction · 0.85
Ext2RefreshGroupFunction · 0.85
Ext2SaveSuperFunction · 0.85
sync_blockdevFunction · 0.85
jbd2_journal_wipeFunction · 0.85
jbd2_journal_destroyFunction · 0.85
Ext2FreeMcbFunction · 0.85

Tested by

no test coverage detected