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
This commit is contained in:
Axel Dörfler
2007-04-25 12:11:21 +00:00
parent 5c03270bea
commit 1d63cfdc5b
+10 -8
View File
@@ -2027,6 +2027,7 @@ Inode::Free(Transaction &transaction)
} }
//! Synchronizes (writes back to disk) the file stream of the inode.
status_t status_t
Inode::Sync() Inode::Sync()
{ {
@@ -2045,14 +2046,14 @@ Inode::Sync()
if (data->direct[i].IsZero()) if (data->direct[i].IsZero())
return B_OK; return B_OK;
// status = flush_blocks(fVolume->Device(), fVolume->ToBlock(data->direct[i]), status = block_cache_sync_etc(fVolume->BlockCache(),
// data->direct[i].Length()); fVolume->ToBlock(data->direct[i]), data->direct[i].Length());
if (status != B_OK) if (status != B_OK)
return status; return status;
} }
// flush indirect range // flush indirect range
if (data->max_indirect_range == 0) if (data->max_indirect_range == 0)
return B_OK; return B_OK;
@@ -2069,7 +2070,8 @@ Inode::Sync()
if (runs[i].IsZero()) if (runs[i].IsZero())
return B_OK; 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) if (status != B_OK)
return status; return status;
} }
@@ -2081,7 +2083,7 @@ Inode::Sync()
return B_OK; return B_OK;
off_t indirectBlock = fVolume->ToBlock(data->double_indirect); off_t indirectBlock = fVolume->ToBlock(data->double_indirect);
for (int32 l = 0; l < data->double_indirect.Length(); l++) { for (int32 l = 0; l < data->double_indirect.Length(); l++) {
block_run *indirectRuns = (block_run *)cached.SetTo(indirectBlock + l); block_run *indirectRuns = (block_run *)cached.SetTo(indirectBlock + l);
if (indirectRuns == NULL) if (indirectRuns == NULL)
@@ -2103,10 +2105,10 @@ Inode::Sync()
if (runs[i].IsZero()) if (runs[i].IsZero())
return B_OK; return B_OK;
// ToDo: combine single block_runs to bigger ones when // TODO: combine single block_runs to bigger ones when
// they are adjacent // they are adjacent
// status = flush_blocks(fVolume->Device(), fVolume->ToBlock(runs[i]), status = block_cache_sync_etc(fVolume->BlockCache(),
// runs[i].Length()); fVolume->ToBlock(runs[i]), runs[i].Length());
if (status != B_OK) if (status != B_OK)
return status; return status;
} }