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

Function Ext2ExpandBlock

Ext4Fsd/ext3/indirect.c:340–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338
339
340NTSTATUS
341Ext2ExpandBlock(
342 IN PEXT2_IRP_CONTEXT IrpContext,
343 IN PEXT2_VCB Vcb,
344 IN PEXT2_MCB Mcb,
345 IN ULONG Base,
346 IN ULONG Layer,
347 IN ULONG Start,
348 IN ULONG SizeArray,
349 IN PULONG BlockArray,
350 IN PULONG Hint,
351 IN PULONG Extra
352)
353{
354 ULONG i = 0;
355 ULONG j;
356 ULONG Slot;
357 ULONG Block = 0;
358 LARGE_INTEGER Offset;
359
360 PBCB Bcb = NULL;
361 PULONG pData = NULL;
362 ULONG Skip = 0;
363
364 ULONG Number;
365 ULONG Wanted;
366
367 NTSTATUS Status = STATUS_SUCCESS;
368
369 if (Layer == 1) {
370
371 /*
372 * try to make all leaf block continuous to avoid fragments
373 */
374
375 Number = min(SizeArray, ((*Extra + (Start & (BLOCK_SIZE/4 - 1))) * 4 / BLOCK_SIZE));
376 Wanted = 0;
377 DEBUG(DL_BLK, ("Ext2ExpandBlock: SizeArray=%xh Extra=%xh Start=%xh %xh\n",
378 SizeArray, *Extra, Start, Number ));
379
380 for (i=0; i < Number; i++) {
381 if (BlockArray[i] == 0) {
382 Wanted += 1;
383 }
384 }
385
386 i = 0;
387 while (Wanted > 0) {
388
389 Number = Wanted;
390 Status = Ext2ExpandLast(
391 IrpContext,
392 Vcb,
393 Mcb,
394 Base,
395 Layer,
396 NULL,
397 Hint,

Callers 1

Ext2ExpandIndirectFunction · 0.85

Calls 7

Ext2ExpandLastFunction · 0.85
Ext2AddBlockExtentFunction · 0.85
Ext2ClearAllExtentsFunction · 0.85
Ext2AddMcbMetaExtsFunction · 0.85
Ext2SleepFunction · 0.85
Ext2SaveBlockFunction · 0.85
Ext2FreePoolFunction · 0.85

Tested by

no test coverage detected