From 897a2e211316e5b08bb6784cc59ad0c80762aa46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 5 Nov 2008 16:09:47 +0000 Subject: [PATCH] * The block allocator now uses block_cache_discard() to make sure the file and the block cache don't interfere when working on the same blocks. * This has fixed all kinds of file corruptions I could reproduce before, therefore likely also bug #3010. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28517 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp index 78758c5edd..bc1dbf1c6a 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp @@ -867,6 +867,11 @@ BlockAllocator::AllocateBlocks(Transaction& transaction, int32 groupIndex, // If the value is not correct at mount time, it will be // fixed anyway. + // We need to flush any remaining blocks in the new allocation to make sure + // they won't interfere with the file cache. + block_cache_discard(fVolume->BlockCache(), fVolume->ToBlock(run), + run.Length()); + T(Allocate(run)); return B_OK; }