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

Function Ext2LoadGroup

Ext4Fsd/ext3/generic.c:203–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201
202
203BOOLEAN
204Ext2LoadGroup(IN PEXT2_VCB Vcb)
205{
206 struct super_block *sb = &Vcb->sb;
207 struct ext4_sb_info *sbi = &Vcb->sbi;
208 ext3_fsblk_t sb_block = 1;
209 unsigned long i;
210 BOOLEAN rc = FALSE;
211
212 __try {
213
214 ExAcquireResourceExclusiveLite(&Vcb->sbi.s_gd_lock, TRUE);
215
216 if (NULL == sbi->s_gd) {
217 sbi->s_gd = kzalloc(sbi->s_gdb_count * sizeof(struct ext3_gd),
218 GFP_KERNEL);
219 }
220 if (sbi->s_gd == NULL) {
221 DEBUG(DL_ERR, ("Ext2LoadGroup: not enough memory.\n"));
222 __leave;
223 }
224
225 if (BLOCK_SIZE != EXT3_MIN_BLOCK_SIZE) {
226 sb_block = EXT4_MIN_BLOCK_SIZE / BLOCK_SIZE;
227 }
228
229 for (i = 0; i < sbi->s_gdb_count; i++) {
230 sbi->s_gd[i].block = descriptor_loc(sb, sb_block, i);
231 if (!sbi->s_gd[i].block) {
232 DEBUG(DL_ERR, ("Ext2LoadGroup: can't locate group descriptor %d\n", i));
233 __leave;
234 }
235 }
236
237 if (!Ext2LoadGroupBH(Vcb)) {
238 DEBUG(DL_ERR, ("Ext2LoadGroup: Failed to load group descriptions !\n"));
239 __leave;
240 }
241
242 if (!ext4_check_descriptors(sb)) {
243 DbgBreak();
244 DEBUG(DL_ERR, ("Ext2LoadGroup: group descriptors corrupted !\n"));
245 __leave;
246 }
247
248 SetFlag(Vcb->Flags, VCB_GD_LOADED);
249 rc = TRUE;
250
251 } __finally {
252
253 if (!rc)
254 Ext2PutGroup(Vcb);
255
256 ExReleaseResourceLite(&Vcb->sbi.s_gd_lock);
257 }
258
259 return rc;
260}

Callers 2

Ext2InitializeVcbFunction · 0.85
ext4_get_group_descFunction · 0.85

Calls 5

kzallocFunction · 0.85
descriptor_locFunction · 0.85
Ext2LoadGroupBHFunction · 0.85
ext4_check_descriptorsFunction · 0.85
Ext2PutGroupFunction · 0.85

Tested by

no test coverage detected