mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 12:45:16 +00:00
Filip Navara <xnavara at volny dot cz>
- Remove unused code from HvGetCellSize(). - Fix situation, when a new cell is allocated with a too small size, resulting in an empty free cell (a cell has to be able to store at least one HCELL_INDEX), then the free list code overrides the next cell after the empty one. - Reenable commented out assert in HvpRemoveFree(), since now it works as expected. svn path=/trunk/; revision=31221
This commit is contained in:
parent
716baf379c
commit
541c17ddaa
|
@ -103,7 +103,6 @@ HvMarkCellDirty(
|
|||
HCELL_INDEX CellIndex,
|
||||
BOOLEAN HoldingLock)
|
||||
{
|
||||
LONG CellSize;
|
||||
ULONG CellBlock;
|
||||
ULONG CellLastBlock;
|
||||
|
||||
|
@ -118,10 +117,6 @@ HvMarkCellDirty(
|
|||
CellBlock = (CellIndex & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT;
|
||||
CellLastBlock = ((CellIndex + HV_BLOCK_SIZE - 1) & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT;
|
||||
|
||||
CellSize = HvpGetCellFullSize(RegistryHive, HvGetCell(RegistryHive, CellIndex));
|
||||
if (CellSize < 0)
|
||||
CellSize = -CellSize;
|
||||
|
||||
RtlSetBits(&RegistryHive->DirtyVector,
|
||||
CellBlock, CellLastBlock - CellBlock);
|
||||
return TRUE;
|
||||
|
@ -229,7 +224,7 @@ HvpRemoveFree(
|
|||
pFreeCellOffset = FreeCellData;
|
||||
}
|
||||
|
||||
//ASSERT(FALSE);
|
||||
ASSERT(FALSE);
|
||||
}
|
||||
|
||||
static HCELL_INDEX CMAPI
|
||||
|
@ -349,8 +344,13 @@ HvAllocateCell(
|
|||
FreeCell = HvpGetCellHeader(RegistryHive, FreeCellOffset);
|
||||
|
||||
/* Split the block in two parts */
|
||||
/* FIXME: There is some minimal cell size that we must respect. */
|
||||
if ((ULONG)FreeCell->Size > Size + sizeof(HCELL_INDEX))
|
||||
|
||||
/* The free block that is created has to be at least
|
||||
sizeof(HCELL) + sizeof(HCELL_INDEX) big, so that free
|
||||
cell list code can work. Moreover we round cell sizes
|
||||
to 16 bytes, so creating a smaller block would result in
|
||||
a cell that would never be allocated. */
|
||||
if ((ULONG)FreeCell->Size > Size + 16)
|
||||
{
|
||||
NewCell = (PHCELL)((ULONG_PTR)FreeCell + Size);
|
||||
NewCell->Size = FreeCell->Size - Size;
|
||||
|
|
Loading…
Reference in a new issue