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

Function Ext2NewBlock

Ext4Fsd/ext3/generic.c:961–1171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

959}
960
961NTSTATUS
962Ext2NewBlock(
963 IN PEXT2_IRP_CONTEXT IrpContext,
964 IN PEXT2_VCB Vcb,
965 IN ULONG GroupHint,
966 IN ULONG BlockHint,
967 OUT PULONG Block,
968 IN OUT PULONG Number
969)
970{
971 struct super_block *sb = &Vcb->sb;
972 PEXT2_GROUP_DESC gd;
973 struct buffer_head *gb = NULL;
974 struct buffer_head *bh = NULL;
975 ext4_fsblk_t bitmap_blk;
976
977 RTL_BITMAP BlockBitmap;
978
979 ULONG Group = 0;
980 ULONG Index = 0xFFFFFFFF;
981 ULONG dwHint = 0;
982 ULONG Count = 0;
983 ULONG Length = 0;
984
985 NTSTATUS Status = STATUS_DISK_FULL;
986
987 *Block = 0;
988
989 ExAcquireResourceExclusiveLite(&Vcb->MetaBlock, TRUE);
990
991 /* validate the hint group and hint block */
992 if (GroupHint >= Vcb->sbi.s_groups_count) {
993 DbgBreak();
994 GroupHint = Vcb->sbi.s_groups_count - 1;
995 }
996
997 if (BlockHint != 0) {
998 GroupHint = (BlockHint - EXT2_FIRST_DATA_BLOCK) / BLOCKS_PER_GROUP;
999 dwHint = (BlockHint - EXT2_FIRST_DATA_BLOCK) % BLOCKS_PER_GROUP;
1000 }
1001
1002 Group = GroupHint;
1003
1004Again:
1005
1006 if (bh)
1007 fini_bh(&bh);
1008
1009 if (gb)
1010 fini_bh(&gb);
1011
1012 gd = ext4_get_group_desc(sb, Group, &gb);
1013 if (!gd) {
1014 DbgBreak();
1015 Status = STATUS_INSUFFICIENT_RESOURCES;
1016 goto errorout;
1017 }
1018

Callers 3

Ext2ExpandLastFunction · 0.85
ext4_new_meta_blocksFunction · 0.85
ext4_new_meta_blocksFunction · 0.85

Calls 15

fini_bhFunction · 0.85
ext4_get_group_descFunction · 0.85
ext4_block_bitmapFunction · 0.85
sb_getblk_zeroFunction · 0.85
ext4_group_desc_csum_setFunction · 0.85
ext4_init_block_bitmapFunction · 0.85
Ext2SaveGroupFunction · 0.85
sb_getblkFunction · 0.85
bh_submit_readFunction · 0.85
Ext2WinntErrorFunction · 0.85
ext4_free_blks_countFunction · 0.85

Tested by

no test coverage detected