added large files feature support

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39120 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2010-10-24 09:13:47 +00:00
parent 0dbbb46e17
commit 7babd0d5ea
4 changed files with 26 additions and 2 deletions

View File

@ -129,6 +129,12 @@ Inode::WriteBack(Transaction& transaction)
if (status != B_OK)
return status;
if (Node().Size() > 0x7fffffffLL) {
status = fVolume->ActivateLargeFiles(transaction);
if (status != B_OK)
return status;
}
CachedBlock cached(fVolume);
uint8* inodeBlockData = cached.SetToWritable(transaction, inodeBlock);
if (inodeBlockData == NULL)

View File

@ -496,6 +496,7 @@ Volume::_UnsupportedIncompatibleFeatures(ext2_super_block& superBlock)
Volume::_UnsupportedReadOnlyFeatures(ext2_super_block& superBlock)
{
uint32 supportedReadOnly = EXT2_READ_ONLY_FEATURE_SPARSE_SUPER
| EXT2_READ_ONLY_FEATURE_LARGE_FILE
| EXT2_READ_ONLY_FEATURE_HUGE_FILE;
// TODO actually implement EXT2_READ_ONLY_FEATURE_SPARSE_SUPER when
// implementing superblock backup copies
@ -588,6 +589,20 @@ Volume::WriteBlockGroup(Transaction& transaction, int32 index)
}
status_t
Volume::ActivateLargeFiles(Transaction& transaction)
{
if ((fSuperBlock.ReadOnlyFeatures()
& EXT2_READ_ONLY_FEATURE_LARGE_FILE) != 0)
return B_OK;
fSuperBlock.SetReadOnlyFeatures(fSuperBlock.ReadOnlyFeatures()
| EXT2_READ_ONLY_FEATURE_LARGE_FILE);
return WriteSuperBlock(transaction);
}
status_t
Volume::SaveOrphan(Transaction& transaction, ino_t newID, ino_t& oldID)
{

View File

@ -82,6 +82,7 @@ public:
bool HugeFiles() const
{ return (fSuperBlock.ReadOnlyFeatures()
& EXT2_READ_ONLY_FEATURE_HUGE_FILE) != 0; }
status_t ActivateLargeFiles(Transaction& transaction);
status_t SaveOrphan(Transaction& transaction,
ino_t newID, ino_t &oldID);

View File

@ -123,7 +123,9 @@ struct ext2_super_block {
{ free_blocks = B_HOST_TO_LENDIAN_INT32(freeBlocks); }
void SetLastOrphan(ino_t id)
{ last_orphan = B_HOST_TO_LENDIAN_INT32((uint32)id); }
void SetReadOnlyFeatures(uint32 readOnlyFeatures) const
{ readOnlyFeatures = B_HOST_TO_LENDIAN_INT32(readOnlyFeatures); }
bool IsValid();
// implemented in Volume.cpp
} _PACKED;
@ -147,7 +149,7 @@ struct ext2_super_block {
// read-only compatible features
#define EXT2_READ_ONLY_FEATURE_SPARSE_SUPER 0x0001
#define EXT2_READ_ONLY_FEATURE_LARGE_FILE 0x0002
#define EXT2_READ_ONLY_FEATURE_LARGE_FILE 0x0002
#define EXT2_READ_ONLY_FEATURE_BTREE_DIRECTORY 0x0004
#define EXT2_READ_ONLY_FEATURE_HUGE_FILE 0x0008