fixed warnings, added a better label for >1TB sized volumes

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39253 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2010-11-01 16:33:25 +00:00
parent f10a55a632
commit 8d5a0a8ff1
5 changed files with 32 additions and 31 deletions
@@ -100,9 +100,8 @@ DirectoryIterator::Get(char* name, size_t* _nameLength, ino_t* _id)
size_t length = entry->NameLength(); size_t length = entry->NameLength();
TRACE("block %lu, displacement %lu: entry ino %lu, length %u, " TRACE("block %lu, displacement %lu: entry ino %lu, length %u, "
"name length %lu, type %lu\n", fLogicalBlock, fDisplacement, "name length %lu, type %u\n", fLogicalBlock, fDisplacement,
entry->InodeID(), entry->Length(), (uint32)length, entry->InodeID(), entry->Length(), length, entry->FileType());
(uint32)entry->FileType());
if (*_nameLength > 0) { if (*_nameLength > 0) {
if (*_nameLength < length) if (*_nameLength < length)
@@ -145,7 +144,7 @@ DirectoryIterator::Next()
entry = (ext2_dir_entry*)(block + fDisplacement); entry = (ext2_dir_entry*)(block + fDisplacement);
do { do {
TRACE("Checking entry at block %lu, displacement %lu\n", fPhysicalBlock, TRACE("Checking entry at block %llu, displacement %lu\n", fPhysicalBlock,
fDisplacement); fDisplacement);
if (entry->Length() == 0) { if (entry->Length() == 0) {
@@ -215,7 +214,7 @@ void
DirectoryIterator::Restart() DirectoryIterator::Restart()
{ {
TRACE("DirectoryIterator::Restart(): (logical, physical, displacement): " TRACE("DirectoryIterator::Restart(): (logical, physical, displacement): "
"current: (%lu, %lu, %lu), start: (%lu, %lu, %lu)\n", fLogicalBlock, "current: (%lu, %llu, %lu), start: (%lu, %llu, %lu)\n", fLogicalBlock,
fPhysicalBlock, fDisplacement, fStartLogicalBlock, fStartPhysicalBlock, fPhysicalBlock, fDisplacement, fStartLogicalBlock, fStartPhysicalBlock,
fStartDisplacement); fStartDisplacement);
fLogicalBlock = fStartLogicalBlock; fLogicalBlock = fStartLogicalBlock;
@@ -442,7 +441,7 @@ DirectoryIterator::_AllocateBestEntryInBlock(uint8 nameLength, uint16& pos,
return B_DEVICE_FULL; return B_DEVICE_FULL;
TRACE("DirectoryIterator::_AllocateBestEntryInBlock(): Found a suitable " TRACE("DirectoryIterator::_AllocateBestEntryInBlock(): Found a suitable "
"location: %lu\n", (uint32)bestPos); "location: %u\n", bestPos);
pos = bestPos; pos = bestPos;
newLength = bestRealLength; newLength = bestRealLength;
@@ -455,9 +454,8 @@ DirectoryIterator::_AddEntry(Transaction& transaction, const char* name,
uint8 nameLength, ino_t id, uint8 type, uint16 newLength, uint16 pos, uint8 nameLength, ino_t id, uint8 type, uint16 newLength, uint16 pos,
bool hasPrevious) bool hasPrevious)
{ {
TRACE("DirectoryIterator::_AddEntry(%s, %d, %d, %d, %d, %d, %c)\n", TRACE("DirectoryIterator::_AddEntry(%s, %d, %llu, %d, %d, %d, %c)\n",
name, (int)nameLength, (int)id, (int)type, (int)newLength, (int)pos, name, nameLength, id, type, newLength, pos, hasPrevious ? 't' : 'f');
hasPrevious ? 't' : 'f');
CachedBlock cached(fVolume); CachedBlock cached(fVolume);
uint8* block = cached.SetToWritable(transaction, fPhysicalBlock); uint8* block = cached.SetToWritable(transaction, fPhysicalBlock);
@@ -492,8 +490,8 @@ DirectoryIterator::_SplitIndexedBlock(Transaction& transaction,
uint32 newBlocksPos, bool firstSplit) uint32 newBlocksPos, bool firstSplit)
{ {
// Block is full, split required // Block is full, split required
TRACE("DirectoryIterator::_SplitIndexedBlock(.., %s, %u, %lu, %lu, %c)\n", TRACE("DirectoryIterator::_SplitIndexedBlock(.., %s, %u, %llu, %lu, %c)\n",
name, (unsigned int)nameLength, (uint32)id, newBlocksPos, name, nameLength, id, newBlocksPos,
firstSplit ? 't' : 'f'); firstSplit ? 't' : 'f');
// Allocate a buffer for the entries in the block // Allocate a buffer for the entries in the block
@@ -70,7 +70,7 @@ protected:
uint32 fDisplacement; uint32 fDisplacement;
uint32 fPreviousDisplacement; uint32 fPreviousDisplacement;
uint32 fStartPhysicalBlock; off_t fStartPhysicalBlock;
uint32 fStartLogicalBlock; uint32 fStartLogicalBlock;
uint32 fStartDisplacement; uint32 fStartDisplacement;
@@ -269,7 +269,7 @@ HTreeEntryIterator::GetNext(uint32& childBlock)
uint32 uint32
HTreeEntryIterator::BlocksNeededForNewEntry() HTreeEntryIterator::BlocksNeededForNewEntry()
{ {
TRACE("HTreeEntryIterator::BlocksNeededForNewEntry(): block num: %lu, " TRACE("HTreeEntryIterator::BlocksNeededForNewEntry(): block num: %llu, "
"volume: %p\n", fBlockNum, fVolume); "volume: %p\n", fBlockNum, fVolume);
CachedBlock cached(fVolume); CachedBlock cached(fVolume);
@@ -303,9 +303,9 @@ HTreeEntryIterator::BlocksNeededForNewEntry()
status_t status_t
HTreeEntryIterator::InsertEntry(Transaction& transaction, uint32 hash, HTreeEntryIterator::InsertEntry(Transaction& transaction, uint32 hash,
uint32 blockNum, uint32 newBlocksPos, bool hasCollision) off_t blockNum, off_t newBlocksPos, bool hasCollision)
{ {
TRACE("HTreeEntryIterator::InsertEntry(): block num: %lu\n", fBlockNum); TRACE("HTreeEntryIterator::InsertEntry(): block num: %llu\n", fBlockNum);
CachedBlock cached(fVolume); CachedBlock cached(fVolume);
uint8* blockData = cached.SetToWritable(transaction, fBlockNum); uint8* blockData = cached.SetToWritable(transaction, fBlockNum);
@@ -345,10 +345,10 @@ HTreeEntryIterator::InsertEntry(Transaction& transaction, uint32 hash,
} }
TRACE("HTreeEntryIterator::InsertEntry(): Inserting node. Count: %u, " TRACE("HTreeEntryIterator::InsertEntry(): Inserting node. Count: %u, "
"current entry: %lu\n", (uint16)count, (uint32)fCurrentEntry); "current entry: %u\n", count, fCurrentEntry);
if (count > 0) { if (count > 0) {
TRACE("HTreeEntryIterator::InsertEntry(): memmove(%lu, %lu, %lu)\n", TRACE("HTreeEntryIterator::InsertEntry(): memmove(%u, %u, %u)\n",
fCurrentEntry + 2, fCurrentEntry + 1, count + fFirstEntry fCurrentEntry + 2, fCurrentEntry + 1, count + fFirstEntry
- fCurrentEntry - 1); - fCurrentEntry - 1);
memmove(&entries[fCurrentEntry + 2], &entries[fCurrentEntry + 1], memmove(&entries[fCurrentEntry + 2], &entries[fCurrentEntry + 1],
@@ -34,8 +34,8 @@ public:
uint32 BlocksNeededForNewEntry(); uint32 BlocksNeededForNewEntry();
status_t InsertEntry(Transaction& transaction, status_t InsertEntry(Transaction& transaction,
uint32 hash, uint32 block, uint32 hash, off_t block,
uint32 newBlocksPos, bool hasCollision); off_t newBlocksPos, bool hasCollision);
private: private:
HTreeEntryIterator(uint32 block, HTreeEntryIterator(uint32 block,
uint32 blockSize, Inode* directory, uint32 blockSize, Inode* directory,
+15 -12
View File
@@ -184,7 +184,7 @@ DeviceOpener::GetSize(off_t* _size, uint32* _blockSize)
} }
if (_size) { if (_size) {
*_size = 1LL * geometry.head_count * geometry.cylinder_count *_size = 1ULL * geometry.head_count * geometry.cylinder_count
* geometry.sectors_per_track * geometry.bytes_per_sector; * geometry.sectors_per_track * geometry.bytes_per_sector;
} }
if (_blockSize) if (_blockSize)
@@ -420,11 +420,15 @@ Volume::Mount(const char* deviceName, uint32 flags)
if (!fSuperBlock.name[0]) { if (!fSuperBlock.name[0]) {
// generate a more or less descriptive volume name // generate a more or less descriptive volume name
uint32 divisor = 1UL << 30; off_t divisor = 1ULL << 40;
char unit = 'G'; char unit = 'T';
if (diskSize < divisor) { if (diskSize < divisor) {
divisor = 1UL << 20; divisor = 1UL << 30;
unit = 'M'; unit = 'G';
if (diskSize < divisor) {
divisor = 1UL << 20;
unit = 'M';
}
} }
double size = double((10 * diskSize + divisor - 1) / divisor); double size = double((10 * diskSize + divisor - 1) / divisor);
@@ -558,13 +562,12 @@ Volume::GetBlockGroup(int32 index, ext2_block_group** _group)
return B_NO_MEMORY; return B_NO_MEMORY;
memcpy(fGroupBlocks[blockIndex], block, fBlockSize); memcpy(fGroupBlocks[blockIndex], block, fBlockSize);
TRACE("group [%ld]: inode table %ld\n", index,
(fGroupBlocks[blockIndex] + index % fGroupsPerBlock)->InodeTable());
} }
*_group = (ext2_block_group*)(fGroupBlocks[blockIndex] *_group = (ext2_block_group*)(fGroupBlocks[blockIndex]
+ (index % fGroupsPerBlock) * fGroupDescriptorSize); + (index % fGroupsPerBlock) * fGroupDescriptorSize);
TRACE("group [%ld]: inode table %lld\n", index,
(*_group)->InodeTable(Has64bitFeature()));
return B_OK; return B_OK;
} }
@@ -760,10 +763,10 @@ Volume::FreeBlocks(Transaction& transaction, off_t start, uint32 length)
if (status != B_OK) if (status != B_OK)
return status; return status;
TRACE("Volume::FreeBlocks(): number of free blocks (before): %lu\n", TRACE("Volume::FreeBlocks(): number of free blocks (before): %llu\n",
fFreeBlocks); fFreeBlocks);
fFreeBlocks += length; fFreeBlocks += length;
TRACE("Volume::FreeBlocks(): number of free blocks (after): %lu\n", TRACE("Volume::FreeBlocks(): number of free blocks (after): %llu\n",
fFreeBlocks); fFreeBlocks);
return WriteSuperBlock(transaction); return WriteSuperBlock(transaction);
@@ -799,8 +802,8 @@ Volume::WriteSuperBlock(Transaction& transaction)
fSuperBlock.SetFreeInodes(fFreeInodes); fSuperBlock.SetFreeInodes(fFreeInodes);
// TODO: Rest of fields that can be modified // TODO: Rest of fields that can be modified
TRACE("Volume::WriteSuperBlock(): free blocks: %lu, free inodes: %lu\n", TRACE("Volume::WriteSuperBlock(): free blocks: %llu, free inodes: %lu\n",
fSuperBlock.FreeBlocks(), fSuperBlock.FreeInodes()); fSuperBlock.FreeBlocks(Has64bitFeature()), fSuperBlock.FreeInodes());
CachedBlock cached(this); CachedBlock cached(this);
uint8* block = cached.SetToWritable(transaction, fFirstDataBlock); uint8* block = cached.SetToWritable(transaction, fFirstDataBlock);