From 1d63cfdc5ba68e1a509cd9d160b1fb14fb8b7bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 25 Apr 2007 12:11:21 +0000 Subject: [PATCH] Now makes use of the new block_cache_etc() function to sync data streams without a file cache attached. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20812 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/bfs/Inode.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/Inode.cpp b/src/add-ons/kernel/file_systems/bfs/Inode.cpp index 39ccbc1328..d1a7e65aba 100644 --- a/src/add-ons/kernel/file_systems/bfs/Inode.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Inode.cpp @@ -2027,6 +2027,7 @@ Inode::Free(Transaction &transaction) } +//! Synchronizes (writes back to disk) the file stream of the inode. status_t Inode::Sync() { @@ -2045,14 +2046,14 @@ Inode::Sync() if (data->direct[i].IsZero()) return B_OK; -// status = flush_blocks(fVolume->Device(), fVolume->ToBlock(data->direct[i]), -// data->direct[i].Length()); + status = block_cache_sync_etc(fVolume->BlockCache(), + fVolume->ToBlock(data->direct[i]), data->direct[i].Length()); if (status != B_OK) return status; } // flush indirect range - + if (data->max_indirect_range == 0) return B_OK; @@ -2069,7 +2070,8 @@ Inode::Sync() if (runs[i].IsZero()) return B_OK; -// status = flush_blocks(fVolume->Device(), fVolume->ToBlock(runs[i]), runs[i].Length()); + status = block_cache_sync_etc(fVolume->BlockCache(), + fVolume->ToBlock(runs[i]), runs[i].Length()); if (status != B_OK) return status; } @@ -2081,7 +2083,7 @@ Inode::Sync() return B_OK; off_t indirectBlock = fVolume->ToBlock(data->double_indirect); - + for (int32 l = 0; l < data->double_indirect.Length(); l++) { block_run *indirectRuns = (block_run *)cached.SetTo(indirectBlock + l); if (indirectRuns == NULL) @@ -2103,10 +2105,10 @@ Inode::Sync() if (runs[i].IsZero()) return B_OK; - // ToDo: combine single block_runs to bigger ones when + // TODO: combine single block_runs to bigger ones when // they are adjacent -// status = flush_blocks(fVolume->Device(), fVolume->ToBlock(runs[i]), -// runs[i].Length()); + status = block_cache_sync_etc(fVolume->BlockCache(), + fVolume->ToBlock(runs[i]), runs[i].Length()); if (status != B_OK) return status; }