* For whatever weird reason, BFS apparently restricts a log entry to 126
entries, even though many more could fit in the blog. This fixes mounting a dirty (original-)BFS volume with a block size larger than 1024 bytes, and probably vice versa. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24401 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -24,8 +24,7 @@ struct run_array {
|
|||||||
// that -1 accounts for an off-by-one error in Be's BFS implementation
|
// that -1 accounts for an off-by-one error in Be's BFS implementation
|
||||||
const block_run &RunAt(int32 i) const { return runs[i]; }
|
const block_run &RunAt(int32 i) const { return runs[i]; }
|
||||||
|
|
||||||
static int32 MaxRuns(int32 blockSize)
|
static int32 MaxRuns(int32 blockSize);
|
||||||
{ return (blockSize - sizeof(run_array)) / sizeof(block_run); }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int _Compare(block_run &a, block_run &b);
|
static int _Compare(block_run &a, block_run &b);
|
||||||
@@ -152,6 +151,18 @@ run_array::Insert(block_run &run)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*static*/ int32
|
||||||
|
run_array::MaxRuns(int32 blockSize)
|
||||||
|
{
|
||||||
|
// For whatever reason, BFS restricts the maximum array size
|
||||||
|
uint32 maxCount = (blockSize - sizeof(run_array)) / sizeof(block_run);
|
||||||
|
if (maxCount < 128)
|
||||||
|
return maxCount;
|
||||||
|
|
||||||
|
return 127;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*static*/ int
|
/*static*/ int
|
||||||
run_array::_Compare(block_run &a, block_run &b)
|
run_array::_Compare(block_run &a, block_run &b)
|
||||||
{
|
{
|
||||||
@@ -424,8 +435,10 @@ Journal::_ReplayRunArray(int32 *_start)
|
|||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
// This log entry writes over the super block - check if
|
// This log entry writes over the super block - check if
|
||||||
// it's valid!
|
// it's valid!
|
||||||
if (Volume::CheckSuperBlock(data) != B_OK)
|
if (Volume::CheckSuperBlock(data) != B_OK) {
|
||||||
|
FATAL(("Log contains invalid super block!\n"));
|
||||||
RETURN_ERROR(B_BAD_DATA);
|
RETURN_ERROR(B_BAD_DATA);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t written = write_pos(fVolume->Device(), offset, data,
|
ssize_t written = write_pos(fVolume->Device(), offset, data,
|
||||||
@@ -475,7 +488,7 @@ Journal::ReplayLog()
|
|||||||
}
|
}
|
||||||
start = start % fLogSize;
|
start = start % fLogSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT(("replaying worked fine!\n"));
|
PRINT(("replaying worked fine!\n"));
|
||||||
fVolume->SuperBlock().log_start = fVolume->LogEnd();
|
fVolume->SuperBlock().log_start = fVolume->LogEnd();
|
||||||
fVolume->LogStart() = fVolume->LogEnd();
|
fVolume->LogStart() = fVolume->LogEnd();
|
||||||
@@ -731,7 +744,7 @@ Journal::_WriteTransactionToLog()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Journal::FlushLogAndBlocks()
|
Journal::FlushLogAndBlocks()
|
||||||
{
|
{
|
||||||
status_t status = fLock.Lock();
|
status_t status = fLock.Lock();
|
||||||
@@ -861,7 +874,7 @@ Journal::_TransactionDone(bool success)
|
|||||||
// #pragma mark - Transaction
|
// #pragma mark - Transaction
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Transaction::Start(Volume *volume, off_t refBlock)
|
Transaction::Start(Volume *volume, off_t refBlock)
|
||||||
{
|
{
|
||||||
// has it already been started?
|
// has it already been started?
|
||||||
|
|||||||
Reference in New Issue
Block a user