ramfs: Optimize Volume::NodeAttributeRemoved() slightly.

Use the pointer to the Index stored with the Attribute
rather than doing an unnecessary lookup.

Also clean up code style.
This commit is contained in:
Augustin Cavalier
2025-08-28 19:39:40 -04:00
parent 8aae7e134a
commit effc4f4704
@@ -632,26 +632,23 @@ Volume::NodeAttributeAdded(ino_t id, Attribute *attribute)
status_t
Volume::NodeAttributeRemoved(ino_t id, Attribute *attribute)
{
status_t error = (attribute ? B_OK : B_BAD_VALUE);
if (error == B_OK) {
// notify the respective attribute index
if (error == B_OK) {
if (AttributeIndex *index = FindAttributeIndex(
attribute->GetName(), attribute->GetType())) {
index->Removed(attribute);
}
}
if (attribute == NULL)
return B_BAD_VALUE;
// update live queries
if (error == B_OK && attribute->GetNode()) {
uint8 oldKey[kMaxIndexKeyLength];
size_t oldLength;
attribute->GetKey(oldKey, &oldLength);
UpdateLiveQueries(NULL, attribute->GetNode(), attribute->GetName(),
attribute->GetType(), oldKey, oldLength, NULL, 0);
}
// notify the attribute index
if (AttributeIndex *index = attribute->GetIndex())
index->Removed(attribute);
// update live queries
if (attribute->GetNode() != NULL) {
uint8 oldKey[kMaxIndexKeyLength];
size_t oldLength;
attribute->GetKey(oldKey, &oldLength);
UpdateLiveQueries(NULL, attribute->GetNode(), attribute->GetName(),
attribute->GetType(), oldKey, oldLength, NULL, 0);
}
return error;
return B_OK;
}