* Build fix for the boot loader (it's now using the new utility functions as
well). Sorry! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33560 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
daff73b116
commit
361f5cdfaf
@ -1790,7 +1790,7 @@ BlockAllocator::CheckInode(Inode* inode, check_control* control)
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
int32 runsPerBlock = runs_per_block(fVolume);
|
||||
int32 runsPerBlock = runs_per_block(fVolume->BlockSize());
|
||||
int32 runsPerArray = runsPerBlock * data->double_indirect.Length();
|
||||
|
||||
CachedBlock cachedDirect(fVolume);
|
||||
|
@ -1327,8 +1327,8 @@ Inode::AllocatedSize() const
|
||||
if (data.MaxDoubleIndirectRange() != 0) {
|
||||
off_t doubleIndirectSize = data.MaxDoubleIndirectRange()
|
||||
- data.MaxIndirectRange();
|
||||
int32 indirectSize = double_indirect_max_indirect_size(fVolume,
|
||||
data.double_indirect.Length());
|
||||
int32 indirectSize = double_indirect_max_indirect_size(
|
||||
data.double_indirect.Length(), fVolume->BlockSize());
|
||||
|
||||
size += (2 * data.double_indirect.Length()
|
||||
+ doubleIndirectSize / indirectSize)
|
||||
@ -1372,8 +1372,8 @@ Inode::FindBlockRun(off_t pos, block_run& run, off_t& offset)
|
||||
int32 runsPerBlock;
|
||||
int32 directSize;
|
||||
int32 indirectSize;
|
||||
get_double_indirect_sizes(fVolume, data->double_indirect.Length(),
|
||||
runsPerBlock, directSize, indirectSize);
|
||||
get_double_indirect_sizes(data->double_indirect.Length(),
|
||||
fVolume->BlockSize(), runsPerBlock, directSize, indirectSize);
|
||||
|
||||
off_t start = pos - data->MaxIndirectRange();
|
||||
int32 index = start / indirectSize;
|
||||
@ -1855,8 +1855,8 @@ Inode::_GrowStream(Transaction& transaction, off_t size)
|
||||
int32 runsPerBlock;
|
||||
int32 directSize;
|
||||
int32 indirectSize;
|
||||
get_double_indirect_sizes(fVolume, data->double_indirect.Length(),
|
||||
runsPerBlock, directSize, indirectSize);
|
||||
get_double_indirect_sizes(data->double_indirect.Length(),
|
||||
fVolume->BlockSize(), runsPerBlock, directSize, indirectSize);
|
||||
|
||||
off_t start = data->MaxDoubleIndirectRange()
|
||||
- data->MaxIndirectRange();
|
||||
@ -1957,10 +1957,13 @@ Inode::_FreeStaticStreamArray(Transaction& transaction, int32 level,
|
||||
block_run run, off_t size, off_t offset, off_t& max)
|
||||
{
|
||||
int32 indirectSize;
|
||||
if (level == 0)
|
||||
indirectSize = double_indirect_max_indirect_size(fVolume, run.Length());
|
||||
else
|
||||
indirectSize = double_indirect_max_direct_size(fVolume, run.Length());
|
||||
if (level == 0) {
|
||||
indirectSize = double_indirect_max_indirect_size(run.Length(),
|
||||
fVolume->BlockSize());
|
||||
} else {
|
||||
indirectSize = double_indirect_max_direct_size(run.Length(),
|
||||
fVolume->BlockSize());
|
||||
}
|
||||
|
||||
off_t start;
|
||||
if (size > offset)
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "system_dependencies.h"
|
||||
|
||||
#include "Volume.h"
|
||||
#include "bfs.h"
|
||||
|
||||
|
||||
enum inode_type {
|
||||
@ -96,33 +96,37 @@ get_shift(uint64 i)
|
||||
|
||||
|
||||
inline int32
|
||||
runs_per_block(Volume* volume)
|
||||
runs_per_block(uint32 blockSize)
|
||||
{
|
||||
return volume->BlockSize() / sizeof(block_run);
|
||||
#ifdef _BOOT_MODE
|
||||
using namespace BFS;
|
||||
#endif
|
||||
|
||||
return blockSize / sizeof(struct block_run);
|
||||
}
|
||||
|
||||
|
||||
inline int32
|
||||
double_indirect_max_direct_size(Volume* volume, uint32 baseLength)
|
||||
double_indirect_max_direct_size(uint32 baseLength, uint32 blockSize)
|
||||
{
|
||||
return baseLength << volume->BlockShift();
|
||||
return baseLength * blockSize;
|
||||
}
|
||||
|
||||
|
||||
inline int32
|
||||
double_indirect_max_indirect_size(Volume* volume, uint32 baseLength)
|
||||
double_indirect_max_indirect_size(uint32 baseLength, uint32 blockSize)
|
||||
{
|
||||
return baseLength * double_indirect_max_direct_size(volume, baseLength)
|
||||
* runs_per_block(volume);
|
||||
return baseLength * double_indirect_max_direct_size(baseLength, blockSize)
|
||||
* runs_per_block(blockSize);
|
||||
}
|
||||
|
||||
|
||||
inline void
|
||||
get_double_indirect_sizes(Volume* volume, uint32 baseLength,
|
||||
get_double_indirect_sizes(uint32 baseLength, uint32 blockSize,
|
||||
int32& runsPerBlock, int32& directSize, int32& indirectSize)
|
||||
{
|
||||
runsPerBlock = runs_per_block(volume);
|
||||
directSize = double_indirect_max_direct_size(volume, baseLength);
|
||||
runsPerBlock = runs_per_block(blockSize);
|
||||
directSize = double_indirect_max_direct_size(baseLength, blockSize);
|
||||
indirectSize = baseLength * directSize * runsPerBlock;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
/* Stream - inode stream access functions
|
||||
**
|
||||
** Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* This file may be used under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
//! Inode stream access functions
|
||||
|
||||
|
||||
#include "Stream.h"
|
||||
@ -200,15 +202,17 @@ Stream::FindBlockRun(off_t pos, block_run &run, off_t &offset)
|
||||
|
||||
CachedBlock cached(fVolume);
|
||||
|
||||
int32 runsPerBlock;
|
||||
int32 directSize;
|
||||
int32 indirectSize;
|
||||
get_double_indirect_sizes(data.double_indirect.Length(),
|
||||
cached.BlockSize(), runsPerBlock, directSize, indirectSize);
|
||||
|
||||
off_t start = pos - data.MaxIndirectRange();
|
||||
int32 indirectSize = (1L << (INDIRECT_BLOCKS_SHIFT + cached.BlockShift()))
|
||||
* (fVolume.BlockSize() / sizeof(block_run));
|
||||
int32 directSize = NUM_ARRAY_BLOCKS << cached.BlockShift();
|
||||
int32 index = start / indirectSize;
|
||||
int32 runsPerBlock = cached.BlockSize() / sizeof(block_run);
|
||||
|
||||
block_run *indirect = (block_run *)cached.SetTo(
|
||||
fVolume.ToBlock(data.double_indirect) + index / runsPerBlock);
|
||||
fVolume.ToBlock(data.double_indirect) + index / runsPerBlock);
|
||||
if (indirect == NULL)
|
||||
return B_ERROR;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user