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

Function Ext2NewInode

Ext4Fsd/ext3/generic.c:1326–1691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1324
1325
1326NTSTATUS
1327Ext2NewInode(
1328 IN PEXT2_IRP_CONTEXT IrpContext,
1329 IN PEXT2_VCB Vcb,
1330 IN ULONG GroupHint,
1331 IN ULONG Type,
1332 OUT PULONG Inode
1333)
1334{
1335 struct super_block *sb = &Vcb->sb;
1336 PEXT2_GROUP_DESC gd;
1337 struct buffer_head *gb = NULL;
1338 struct buffer_head *bh = NULL;
1339 ext4_fsblk_t bitmap_blk;
1340
1341 RTL_BITMAP InodeBitmap;
1342
1343 ULONG Group, i, j;
1344 ULONG Average, Length;
1345
1346 ULONG dwInode;
1347
1348 NTSTATUS Status = STATUS_DISK_FULL;
1349
1350 *Inode = dwInode = 0XFFFFFFFF;
1351
1352 ExAcquireResourceExclusiveLite(&Vcb->MetaInode, TRUE);
1353
1354 if (GroupHint >= Vcb->sbi.s_groups_count)
1355 GroupHint = GroupHint % Vcb->sbi.s_groups_count;
1356
1357repeat:
1358
1359 if (bh)
1360 fini_bh(&bh);
1361
1362 if (gb)
1363 fini_bh(&gb);
1364
1365 Group = i = 0;
1366 gd = NULL;
1367
1368 if (Type == EXT2_FT_DIR) {
1369
1370 Average = Vcb->SuperBlock->s_free_inodes_count / Vcb->sbi.s_groups_count;
1371
1372 for (j = 0; j < Vcb->sbi.s_groups_count; j++) {
1373
1374 i = (j + GroupHint) % (Vcb->sbi.s_groups_count);
1375 gd = ext4_get_group_desc(sb, i, &gb);
1376 if (!gd) {
1377 DbgBreak();
1378 Status = STATUS_INSUFFICIENT_RESOURCES;
1379 goto errorout;
1380 }
1381
1382 if ((gd->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) ||
1383 (ext4_used_dirs_count(sb, gd) << 8 <

Callers 1

Ext2CreateInodeFunction · 0.85

Calls 15

fini_bhFunction · 0.85
ext4_get_group_descFunction · 0.85
ext4_used_dirs_countFunction · 0.85
ext4_free_inodes_countFunction · 0.85
ext4_inode_bitmapFunction · 0.85
sb_getblk_zeroFunction · 0.85
ext4_group_desc_csum_setFunction · 0.85
ext4_init_inode_bitmapFunction · 0.85
Ext2SaveGroupFunction · 0.85
sb_getblkFunction · 0.85
bh_submit_readFunction · 0.85

Tested by

no test coverage detected