* _Free[InBitmapBlock](): Don't use Block::Discard() (block_cache_discard()).
It doesn't have the intended semantics (reverting the change). The caller is now expected to roll back the transaction. * AllocateExactly(): Don't try to revert a partially successful allocation. The caller is expected to roll back the transaction. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37632 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d9fdb4f6cd
commit
decde2b030
@ -206,10 +206,8 @@ dprintf("BlockAllocator::AllocateExactly(%llu, %llu)\n", base, count);
|
|||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
if (allocated < count) {
|
if (allocated < count)
|
||||||
_Free(base, allocated, transaction);
|
|
||||||
return B_BUSY;
|
return B_BUSY;
|
||||||
}
|
|
||||||
|
|
||||||
return _UpdateSuperBlock(transaction);
|
return _UpdateSuperBlock(transaction);
|
||||||
}
|
}
|
||||||
@ -672,10 +670,8 @@ dprintf("BlockAllocator::_FreeInBitmapBlock(%llu, %lu)\n", base, count);
|
|||||||
if (endOffset < 32)
|
if (endOffset < 32)
|
||||||
mask &= ((uint32)1 << endOffset) - 1;
|
mask &= ((uint32)1 << endOffset) - 1;
|
||||||
|
|
||||||
if ((*bits & mask) != mask) {
|
if ((*bits & mask) != mask)
|
||||||
block.Discard();
|
|
||||||
RETURN_ERROR(B_BAD_VALUE);
|
RETURN_ERROR(B_BAD_VALUE);
|
||||||
}
|
|
||||||
|
|
||||||
*bits &= ~mask;
|
*bits &= ~mask;
|
||||||
remaining -= endOffset - bitOffset;
|
remaining -= endOffset - bitOffset;
|
||||||
@ -683,10 +679,8 @@ dprintf("BlockAllocator::_FreeInBitmapBlock(%llu, %lu)\n", base, count);
|
|||||||
|
|
||||||
// handle complete uint32s in the middle
|
// handle complete uint32s in the middle
|
||||||
while (remaining >= 32) {
|
while (remaining >= 32) {
|
||||||
if (*bits != 0xffffffff) {
|
if (*bits != 0xffffffff)
|
||||||
block.Discard();
|
|
||||||
RETURN_ERROR(B_BUSY);
|
RETURN_ERROR(B_BUSY);
|
||||||
}
|
|
||||||
|
|
||||||
*bits = 0;
|
*bits = 0;
|
||||||
remaining -= 32;
|
remaining -= 32;
|
||||||
@ -696,10 +690,8 @@ dprintf("BlockAllocator::_FreeInBitmapBlock(%llu, %lu)\n", base, count);
|
|||||||
if (remaining > 0) {
|
if (remaining > 0) {
|
||||||
uint32 mask = ((uint32)1 << remaining) - 1;
|
uint32 mask = ((uint32)1 << remaining) - 1;
|
||||||
|
|
||||||
if ((*bits & mask) != mask) {
|
if ((*bits & mask) != mask)
|
||||||
block.Discard();
|
|
||||||
return B_BUSY;
|
return B_BUSY;
|
||||||
}
|
|
||||||
|
|
||||||
*bits &= ~mask;
|
*bits &= ~mask;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user