bfs: BlockAllocator::Reinitialize()

Change-Id: I17d5fb7bbf963a4f03458ba9bd4aee49a757d571
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10059
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
ahenriksson
2026-01-22 16:57:47 +00:00
committed by Axel Dörfler
parent 2d902e5c6b
commit e93c2b5609
2 changed files with 23 additions and 0 deletions
@@ -638,6 +638,28 @@ BlockAllocator::InitializeAndClearBitmap(Transaction& transaction)
}
status_t
BlockAllocator::Reinitialize()
{
// need to write back any pending changes to the block bitmap
// TODO: shall we read through the cache in _Initialize instead?
status_t status = fVolume->GetJournal(0)->FlushLogAndLockJournal();
if (status != B_OK)
return status;
recursive_lock_lock(&fLock);
// the lock will be unlocked in the call to Initialize()
fVolume->GetJournal(0)->Unlock(NULL, true);
// unlock the journal here: we only need to make sure that no one
// starts a transaction before we get the allocator lock, as that
// would cause a deadlock
delete[] fGroups;
return Initialize();
}
status_t
BlockAllocator::_Initialize(BlockAllocator* allocator)
{
@@ -28,6 +28,7 @@ public:
status_t Initialize(bool full = true);
status_t InitializeAndClearBitmap(Transaction& transaction);
status_t Reinitialize();
void Uninitialize();