Oops, this one did only work for my test case...
The last log entry was never added to the list (if there were more than one), and thus, it's blocks were never unlocked nor written back (after some minutes of makehdimage an empty image would greet you). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14427 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f7b4a08237
commit
3a7c99e12d
@ -352,7 +352,7 @@ Journal::WriteLogEntry()
|
||||
|
||||
// Create log entries for the transaction
|
||||
|
||||
LogEntry *logEntry = NULL, *firstEntry = NULL;
|
||||
LogEntry *logEntry = NULL, *firstEntry = NULL, *lastAdded = NULL;
|
||||
|
||||
for (int32 i = 0; i < array->count; i++) {
|
||||
retry:
|
||||
@ -375,6 +375,7 @@ Journal::WriteLogEntry()
|
||||
fEntriesLock.Lock();
|
||||
fEntries.Add(logEntry);
|
||||
fEntriesLock.Unlock();
|
||||
lastAdded = logEntry;
|
||||
|
||||
logEntry = NULL;
|
||||
goto retry;
|
||||
@ -386,6 +387,12 @@ Journal::WriteLogEntry()
|
||||
if (firstEntry == NULL)
|
||||
return B_OK;
|
||||
|
||||
if (logEntry != lastAdded) {
|
||||
fEntriesLock.Lock();
|
||||
fEntries.Add(logEntry);
|
||||
fEntriesLock.Unlock();
|
||||
}
|
||||
|
||||
// Write log entries to disk
|
||||
|
||||
CachedBlock cached(fVolume);
|
||||
@ -432,10 +439,12 @@ Journal::WriteLogEntry()
|
||||
|
||||
for (logEntry = firstEntry; logEntry != NULL; logEntry = fEntries.GetNext(logEntry)) {
|
||||
// Note: this only works this way as we only have block_runs of length 1
|
||||
// We're reusing the fArray array, as we don't need it anymore, and
|
||||
// it's guaranteed to be large enough for us, too
|
||||
for (int32 i = 0; i < logEntry->CountRuns(); i++) {
|
||||
array->values[i] = fVolume->ToBlock(logEntry->RunAt(i));
|
||||
}
|
||||
|
||||
|
||||
set_blocks_info(fVolume->Device(), &array->values[0],
|
||||
logEntry->CountRuns(), blockNotify, logEntry);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user