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