* Fixed another big bug in the logging code: I obviously got confused
what RunArrays::Length() meant; it should have been the length of a log entry, but was only the block count. * Now I've improved naming and fixed initializing the LogEntry with a wrong size, causing subsequent log entries to lose track in the log (the log_start pointer got wrong, so BFS would not be able to replay such a log). * This at least fixes one part of the problem of bug #1911. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24410 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -36,13 +36,14 @@ class RunArrays {
|
|||||||
RunArrays(Journal *journal);
|
RunArrays(Journal *journal);
|
||||||
~RunArrays();
|
~RunArrays();
|
||||||
|
|
||||||
uint32 Length() const { return fLength; }
|
|
||||||
|
|
||||||
status_t Insert(off_t blockNumber);
|
status_t Insert(off_t blockNumber);
|
||||||
|
|
||||||
run_array *ArrayAt(int32 i) { return fArrays.Array()[i]; }
|
run_array *ArrayAt(int32 i) { return fArrays.Array()[i]; }
|
||||||
int32 CountArrays() const { return fArrays.CountItems(); }
|
int32 CountArrays() const { return fArrays.CountItems(); }
|
||||||
|
|
||||||
|
uint32 CountBlocks() const { return fBlockCount; }
|
||||||
|
uint32 LogEntryLength() const { return CountBlocks() + CountArrays(); }
|
||||||
|
|
||||||
int32 MaxArrayLength();
|
int32 MaxArrayLength();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -51,7 +52,7 @@ class RunArrays {
|
|||||||
bool _AddRun(block_run &run);
|
bool _AddRun(block_run &run);
|
||||||
|
|
||||||
Journal *fJournal;
|
Journal *fJournal;
|
||||||
uint32 fLength;
|
uint32 fBlockCount;
|
||||||
Stack<run_array *> fArrays;
|
Stack<run_array *> fArrays;
|
||||||
run_array *fLastArray;
|
run_array *fLastArray;
|
||||||
};
|
};
|
||||||
@@ -213,7 +214,7 @@ run_array::_FindInsertionIndex(block_run &run)
|
|||||||
RunArrays::RunArrays(Journal *journal)
|
RunArrays::RunArrays(Journal *journal)
|
||||||
:
|
:
|
||||||
fJournal(journal),
|
fJournal(journal),
|
||||||
fLength(0),
|
fBlockCount(0),
|
||||||
fArrays(),
|
fArrays(),
|
||||||
fLastArray(NULL)
|
fLastArray(NULL)
|
||||||
{
|
{
|
||||||
@@ -266,7 +267,7 @@ RunArrays::_AddRun(block_run &run)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
fLastArray->Insert(run);
|
fLastArray->Insert(run);
|
||||||
fLength++;
|
fBlockCount++;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -639,7 +640,7 @@ Journal::_WriteTransactionToLog()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runArrays.Length() == 0) {
|
if (runArrays.CountBlocks() == 0) {
|
||||||
// nothing has changed during this transaction
|
// nothing has changed during this transaction
|
||||||
if (detached) {
|
if (detached) {
|
||||||
fTransactionID = cache_detach_sub_transaction(fVolume->BlockCache(),
|
fTransactionID = cache_detach_sub_transaction(fVolume->BlockCache(),
|
||||||
@@ -729,7 +730,7 @@ Journal::_WriteTransactionToLog()
|
|||||||
free(vecs);
|
free(vecs);
|
||||||
|
|
||||||
LogEntry *logEntry = new LogEntry(this, fVolume->LogEnd(),
|
LogEntry *logEntry = new LogEntry(this, fVolume->LogEnd(),
|
||||||
runArrays.Length());
|
runArrays.LogEntryLength());
|
||||||
if (logEntry == NULL) {
|
if (logEntry == NULL) {
|
||||||
FATAL(("no memory to allocate log entries!"));
|
FATAL(("no memory to allocate log entries!"));
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|||||||
Reference in New Issue
Block a user