Forgot to set the new "start" within the blocks range in
AllocationGroup::Allocate()/Free(). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1610 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0cc314e0ac
commit
23d098b60b
@ -120,6 +120,14 @@ AllocationBlock::Allocate(uint16 start, uint16 numBlocks)
|
|||||||
for (int32 i = start % 32;i < 32 && numBlocks;i++, numBlocks--)
|
for (int32 i = start % 32;i < 32 && numBlocks;i++, numBlocks--)
|
||||||
mask |= 1UL << (i % 32);
|
mask |= 1UL << (i % 32);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
/*
|
||||||
|
if (mask & ((uint32 *)fBlock)[block]) {
|
||||||
|
FATAL(("AllocationBlock::Allocate(): some blocks are already allocated, start = %u, numBlocks = %u\n", start, numBlocks));
|
||||||
|
DEBUGGER(("blocks already occupied!"));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
((uint32 *)fBlock)[block++] |= mask;
|
((uint32 *)fBlock)[block++] |= mask;
|
||||||
start = 0;
|
start = 0;
|
||||||
}
|
}
|
||||||
@ -190,13 +198,19 @@ AllocationGroup::AddFreeRange(int32 start, int32 blocks)
|
|||||||
* or the volume's used blocks count.
|
* or the volume's used blocks count.
|
||||||
* It only does the low-level work of allocating some bits
|
* It only does the low-level work of allocating some bits
|
||||||
* in the block bitmap.
|
* in the block bitmap.
|
||||||
|
* Assumes that the block bitmap lock is hold.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
AllocationGroup::Allocate(Transaction *transaction, uint16 start, int32 length)
|
AllocationGroup::Allocate(Transaction *transaction, uint16 start, int32 length)
|
||||||
{
|
{
|
||||||
Volume *volume = transaction->GetVolume();
|
Volume *volume = transaction->GetVolume();
|
||||||
uint32 block = start / (volume->BlockSize() << 3);
|
|
||||||
|
// calculate block in the block bitmap and position within
|
||||||
|
uint32 bitsPerBlock = volume->BlockSize() << 3;
|
||||||
|
uint32 block = start / bitsPerBlock;
|
||||||
|
start = start % bitsPerBlock;
|
||||||
|
|
||||||
AllocationBlock cached(volume);
|
AllocationBlock cached(volume);
|
||||||
|
|
||||||
while (length > 0) {
|
while (length > 0) {
|
||||||
@ -226,13 +240,19 @@ AllocationGroup::Allocate(Transaction *transaction, uint16 start, int32 length)
|
|||||||
* or the volume's used blocks count.
|
* or the volume's used blocks count.
|
||||||
* It only does the low-level work of freeing some bits
|
* It only does the low-level work of freeing some bits
|
||||||
* in the block bitmap.
|
* in the block bitmap.
|
||||||
|
* Assumes that the block bitmap lock is hold.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
AllocationGroup::Free(Transaction *transaction, uint16 start, int32 length)
|
AllocationGroup::Free(Transaction *transaction, uint16 start, int32 length)
|
||||||
{
|
{
|
||||||
Volume *volume = transaction->GetVolume();
|
Volume *volume = transaction->GetVolume();
|
||||||
uint32 block = start / (volume->BlockSize() << 3);
|
|
||||||
|
// calculate block in the block bitmap and position within
|
||||||
|
uint32 bitsPerBlock = volume->BlockSize() << 3;
|
||||||
|
uint32 block = start / bitsPerBlock;
|
||||||
|
start = start % bitsPerBlock;
|
||||||
|
|
||||||
AllocationBlock cached(volume);
|
AllocationBlock cached(volume);
|
||||||
|
|
||||||
while (length > 0) {
|
while (length > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user