diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp index f0ab1ce7e7..4304d8b7f1 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp @@ -626,6 +626,15 @@ BlockAllocator::_Initialize(BlockAllocator *allocator) } +void +BlockAllocator::Uninitialize() +{ + // We only have to make sure that the initializer thread isn't running + // anymore. + mutex_lock(&fLock); +} + + status_t BlockAllocator::AllocateBlocks(Transaction &transaction, int32 group, uint16 start, uint16 maximum, uint16 minimum, block_run &run) diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h index 21fad7792c..2fe0487de8 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h @@ -27,6 +27,8 @@ class BlockAllocator { status_t Initialize(bool full = true); status_t InitializeAndClearBitmap(Transaction &transaction); + void Uninitialize(); + status_t AllocateForInode(Transaction &transaction, const block_run *parent, mode_t type, block_run &run); status_t Allocate(Transaction &transaction, Inode *inode, off_t numBlocks, diff --git a/src/add-ons/kernel/file_systems/bfs/Volume.cpp b/src/add-ons/kernel/file_systems/bfs/Volume.cpp index ac0cee8fc6..9ef825447f 100644 --- a/src/add-ons/kernel/file_systems/bfs/Volume.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Volume.cpp @@ -429,6 +429,8 @@ Volume::Unmount() // Unlike in BeOS, we need to put the reference to our root node ourselves put_vnode(fVolume, ToVnode(Root())); + fBlockAllocator.Uninitialize(); + // This will also flush the log & all blocks to disk delete fJournal; fJournal = NULL;