ramfs: Just use the linked list for attributes instead of a hash table.
This is what packagefs does; so if it's performant enough for packagefs, it's performant enough for us. Greatly simplifies this code (and will allow for further simplification of the NodeChildHash.)
This commit is contained in:
@@ -20,9 +20,6 @@ AllocationInfo::AllocationInfo()
|
||||
fDirectoryEntryTableArraySize(0),
|
||||
fDirectoryEntryTableVectorSize(0),
|
||||
fDirectoryEntryTableElementCount(0),
|
||||
fNodeAttributeTableArraySize(0),
|
||||
fNodeAttributeTableVectorSize(0),
|
||||
fNodeAttributeTableElementCount(0),
|
||||
|
||||
fAttributeCount(0),
|
||||
fAttributeSize(0),
|
||||
@@ -73,18 +70,6 @@ AllocationInfo::AddDirectoryEntryTableAllocation(size_t arraySize,
|
||||
fDirectoryEntryTableElementCount += elementCount;
|
||||
}
|
||||
|
||||
// AddNodeAttributeTableAllocation
|
||||
void
|
||||
AllocationInfo::AddNodeAttributeTableAllocation(size_t arraySize,
|
||||
size_t vectorSize,
|
||||
size_t elementSize,
|
||||
size_t elementCount)
|
||||
{
|
||||
fNodeAttributeTableArraySize += arraySize;
|
||||
fNodeAttributeTableVectorSize += vectorSize * elementSize;
|
||||
fNodeAttributeTableElementCount += elementCount;
|
||||
}
|
||||
|
||||
// AddAttributeAllocation
|
||||
void
|
||||
AllocationInfo::AddAttributeAllocation(size_t size)
|
||||
@@ -187,14 +172,6 @@ AllocationInfo::Dump() const
|
||||
areaSize += fDirectoryEntryTableArraySize * sizeof(int32)
|
||||
+ fDirectoryEntryTableVectorSize;
|
||||
|
||||
PRINT(" attribute table:\n");
|
||||
PRINT(" array size: %9lu\n", fNodeAttributeTableArraySize);
|
||||
PRINT(" vector size: %9lu\n", fNodeAttributeTableVectorSize);
|
||||
PRINT(" elements: %9lu\n", fNodeAttributeTableElementCount);
|
||||
areaCount += 2;
|
||||
areaSize += fNodeAttributeTableArraySize * sizeof(int32)
|
||||
+ fNodeAttributeTableVectorSize;
|
||||
|
||||
PRINT(" attributes: %9lu, size: %9lu\n", fAttributeCount, fAttributeSize);
|
||||
heapCount += fAttributeCount;
|
||||
heapSize += fAttributeCount * sizeof(Attribute);
|
||||
|
||||
@@ -17,9 +17,6 @@ public:
|
||||
void AddDirectoryEntryTableAllocation(size_t arraySize, size_t vectorSize,
|
||||
size_t elementSize,
|
||||
size_t elementCount);
|
||||
void AddNodeAttributeTableAllocation(size_t arraySize, size_t vectorSize,
|
||||
size_t elementSize,
|
||||
size_t elementCount);
|
||||
|
||||
void AddAttributeAllocation(size_t size);
|
||||
void AddDirectoryAllocation();
|
||||
@@ -42,9 +39,6 @@ private:
|
||||
size_t fDirectoryEntryTableArraySize;
|
||||
size_t fDirectoryEntryTableVectorSize;
|
||||
size_t fDirectoryEntryTableElementCount;
|
||||
size_t fNodeAttributeTableArraySize;
|
||||
size_t fNodeAttributeTableVectorSize;
|
||||
size_t fNodeAttributeTableElementCount;
|
||||
|
||||
size_t fAttributeCount;
|
||||
size_t fAttributeSize;
|
||||
|
||||
@@ -274,7 +274,6 @@ Node::FindAttribute(const char *name, Attribute **_attribute) const
|
||||
{
|
||||
status_t error = (name && _attribute ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
/*
|
||||
Attribute *attribute = NULL;
|
||||
while (GetNextAttribute(&attribute) == B_OK) {
|
||||
if (!strcmp(attribute->GetName(), name)) {
|
||||
@@ -283,8 +282,6 @@ Node::FindAttribute(const char *name, Attribute **_attribute) const
|
||||
}
|
||||
}
|
||||
error = B_ENTRY_NOT_FOUND;
|
||||
*/
|
||||
error = GetVolume()->FindNodeAttribute(GetID(), name, _attribute);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -136,7 +136,6 @@ Volume::Volume(fs_volume* volume)
|
||||
fNextNodeID(kRootParentID + 1),
|
||||
fNodeTable(NULL),
|
||||
fDirectoryEntryTable(NULL),
|
||||
fNodeAttributeTable(NULL),
|
||||
fIndexDirectory(NULL),
|
||||
fRootDirectory(NULL),
|
||||
fName(kDefaultVolumeName),
|
||||
@@ -213,14 +212,6 @@ Volume::Mount(uint32 flags)
|
||||
else
|
||||
SET_ERROR(error, B_NO_MEMORY);
|
||||
}
|
||||
// create the node attribute table
|
||||
if (error == B_OK) {
|
||||
fNodeAttributeTable = new(nothrow) NodeAttributeTable;
|
||||
if (fNodeAttributeTable)
|
||||
error = fNodeAttributeTable->InitCheck();
|
||||
else
|
||||
SET_ERROR(error, B_NO_MEMORY);
|
||||
}
|
||||
// create the index directory
|
||||
if (error == B_OK) {
|
||||
fIndexDirectory = new(nothrow) IndexDirectory(this);
|
||||
@@ -272,10 +263,6 @@ Volume::Unmount()
|
||||
fNodeListeners = NULL;
|
||||
}
|
||||
// delete the tables
|
||||
if (fNodeAttributeTable) {
|
||||
delete fNodeAttributeTable;
|
||||
fNodeAttributeTable = NULL;
|
||||
}
|
||||
if (fDirectoryEntryTable) {
|
||||
delete fDirectoryEntryTable;
|
||||
fDirectoryEntryTable = NULL;
|
||||
@@ -660,7 +647,6 @@ Volume::NodeAttributeAdded(ino_t id, Attribute *attribute)
|
||||
{
|
||||
status_t error = (attribute ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
error = fNodeAttributeTable->AddNodeChild(id, attribute);
|
||||
// notify the respective attribute index
|
||||
if (error == B_OK) {
|
||||
if (AttributeIndex *index = FindAttributeIndex(
|
||||
@@ -678,7 +664,6 @@ Volume::NodeAttributeRemoved(ino_t id, Attribute *attribute)
|
||||
{
|
||||
status_t error = (attribute ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
error = fNodeAttributeTable->RemoveNodeChild(id, attribute);
|
||||
// notify the respective attribute index
|
||||
if (error == B_OK) {
|
||||
if (AttributeIndex *index = FindAttributeIndex(
|
||||
@@ -699,19 +684,6 @@ Volume::NodeAttributeRemoved(ino_t id, Attribute *attribute)
|
||||
return error;
|
||||
}
|
||||
|
||||
// FindNodeAttribute
|
||||
status_t
|
||||
Volume::FindNodeAttribute(ino_t id, const char *name, Attribute **attribute)
|
||||
{
|
||||
status_t error = (attribute ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
*attribute = fNodeAttributeTable->GetNodeChild(id, name);
|
||||
if (!*attribute)
|
||||
error = B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
// GetNameIndex
|
||||
NameIndex *
|
||||
Volume::GetNameIndex() const
|
||||
@@ -841,8 +813,6 @@ Volume::GetAllocationInfo(AllocationInfo &info)
|
||||
fNodeTable->GetAllocationInfo(info);
|
||||
info.AddOtherAllocation(sizeof(DirectoryEntryTable));
|
||||
fDirectoryEntryTable->GetAllocationInfo(info);
|
||||
info.AddOtherAllocation(sizeof(NodeAttributeTable));
|
||||
fNodeAttributeTable->GetAllocationInfo(info);
|
||||
// node hierarchy
|
||||
fRootDirectory->GetAllocationInfo(info);
|
||||
// name
|
||||
|
||||
@@ -47,7 +47,6 @@ class IndexDirectory;
|
||||
class LastModifiedIndex;
|
||||
class NameIndex;
|
||||
class Node;
|
||||
class NodeAttributeTable;
|
||||
class NodeListener;
|
||||
class NodeListenerTree;
|
||||
class NodeTable;
|
||||
@@ -136,11 +135,9 @@ public:
|
||||
uint32 flags);
|
||||
status_t RemoveEntryListener(EntryListener *listener, Entry *entry);
|
||||
|
||||
// node attribute table
|
||||
// node attributes
|
||||
status_t NodeAttributeAdded(ino_t id, Attribute *attribute);
|
||||
status_t NodeAttributeRemoved(ino_t id, Attribute *attribute);
|
||||
status_t FindNodeAttribute(ino_t id, const char *name,
|
||||
Attribute **attribute);
|
||||
|
||||
// indices
|
||||
IndexDirectory *GetIndexDirectory() const { return fIndexDirectory; }
|
||||
@@ -186,7 +183,6 @@ private:
|
||||
ino_t fNextNodeID;
|
||||
NodeTable *fNodeTable;
|
||||
DirectoryEntryTable *fDirectoryEntryTable;
|
||||
NodeAttributeTable *fNodeAttributeTable;
|
||||
IndexDirectory *fIndexDirectory;
|
||||
Directory *fRootDirectory;
|
||||
String fName;
|
||||
|
||||
Reference in New Issue
Block a user