public void CommitChanges() { // We must save changes to the SMQ before committing the BBT / NBT if (m_searchManagementQueue != null) { m_searchManagementQueue.SaveChanges(); } this.BlockBTree.SaveChanges(); this.NodeBTree.SaveChanges(); // Only after we saved changes to the BBT, we may free blocks, // this is to prevent blocks that are referenced by the BBT to be freed prematurely (before changes are committed) foreach (KeyValuePair <ulong, int> offsetToFree in m_offsetsToFree) { ulong offset = offsetToFree.Key; int length = offsetToFree.Value; AllocationHelper.FreeAllocation(this, (long)offset, length); } m_offsetsToFree.Clear(); UpdateBlockBTreeRootReference(); UpdateNodeBTreeRootReference(); }