private void AddSection() { FileSection n = new FileSection(_sections.Length, BlockSize); lock (_sync) { n.Commit(_fput, false); n.Commit(_fput, true); } FileSection[] grow = new FileSection[_sections.Length + 1]; _sections.CopyTo(grow, 0); grow[_sections.Length] = n; OrdinalList freeblocks = _freeBlocks.Clone(); freeblocks.Ceiling = (grow.Length * BlocksPerSection) - 1; OrdinalList freehandles = _freeHandles.Clone(); freehandles.Ceiling = (grow.Length * BlocksPerSection) - 1; // First and last handles/blocks are reserved by the section int lastFree = grow.Length * BlocksPerSection - 1; int firstFree = lastFree - BlocksPerSection + 2; for (int i = firstFree; i < lastFree; i++) { freehandles.Add(i); freeblocks.Add(i); } _sections = grow; _freeHandles = freehandles; _freeBlocks = freeblocks; }