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

Function Ext2FreeInode

Ext4Fsd/ext3/generic.c:1731–1842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1729
1730
1731NTSTATUS
1732Ext2FreeInode(
1733 IN PEXT2_IRP_CONTEXT IrpContext,
1734 IN PEXT2_VCB Vcb,
1735 IN ULONG Inode,
1736 IN ULONG Type
1737)
1738{
1739 struct super_block *sb = &Vcb->sb;
1740 PEXT2_GROUP_DESC gd;
1741 struct buffer_head *gb = NULL;
1742 struct buffer_head *bh = NULL;
1743 ext4_fsblk_t bitmap_blk;
1744
1745 RTL_BITMAP InodeBitmap;
1746 ULONG Group;
1747 ULONG Length;
1748 LARGE_INTEGER Offset;
1749
1750 ULONG dwIno;
1751 BOOLEAN bModified = FALSE;
1752
1753 NTSTATUS Status = STATUS_UNSUCCESSFUL;
1754
1755 ExAcquireResourceExclusiveLite(&Vcb->MetaInode, TRUE);
1756
1757 Group = (Inode - 1) / INODES_PER_GROUP;
1758 dwIno = (Inode - 1) % INODES_PER_GROUP;
1759
1760 DEBUG(DL_INF, ( "Ext2FreeInode: Inode: %xh (Group/Off = %xh/%xh)\n",
1761 Inode, Group, dwIno));
1762
1763 if (Group >= Vcb->sbi.s_groups_count) {
1764 DbgBreak();
1765 goto errorout;
1766 }
1767
1768 gd = ext4_get_group_desc(sb, Group, &gb);
1769 if (!gd) {
1770 DbgBreak();
1771 Status = STATUS_INSUFFICIENT_RESOURCES;
1772 goto errorout;
1773 }
1774
1775 bitmap_blk = ext4_inode_bitmap(sb, gd);
1776 bh = sb_getblk(sb, bitmap_blk);
1777 if (!bh) {
1778 DbgBreak();
1779 Status = STATUS_INSUFFICIENT_RESOURCES;
1780 goto errorout;
1781 }
1782 if (!buffer_uptodate(bh)) {
1783 int err = bh_submit_read(bh);
1784 if (err < 0) {
1785 DbgPrint("bh_submit_read error! err: %d\n", err);
1786 Status = Ext2WinntError(err);
1787 goto errorout;
1788 }

Callers 2

Ext2DeleteFileFunction · 0.85
Ext2CreateInodeFunction · 0.85

Calls 13

ext4_get_group_descFunction · 0.85
ext4_inode_bitmapFunction · 0.85
sb_getblkFunction · 0.85
bh_submit_readFunction · 0.85
Ext2WinntErrorFunction · 0.85
ext4_free_inodes_setFunction · 0.85
mark_buffer_dirtyFunction · 0.85
ext4_used_dirs_setFunction · 0.85
ext4_used_dirs_countFunction · 0.85
Ext2SaveGroupFunction · 0.85
Ext2UpdateVcbStatFunction · 0.85

Tested by

no test coverage detected