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 status_t
Volume::NodeAttributeRemoved(ino_t id, Attribute *attribute) Volume::NodeAttributeRemoved(ino_t id, Attribute *attribute)
{ {
status_t error = (attribute ? B_OK : B_BAD_VALUE); if (attribute == NULL)
if (error == B_OK) { return B_BAD_VALUE;
// notify the respective attribute index
if (error == B_OK) {
if (AttributeIndex *index = FindAttributeIndex(
attribute->GetName(), attribute->GetType())) {
index->Removed(attribute);
}
}
// update live queries // notify the attribute index
if (error == B_OK && attribute->GetNode()) { if (AttributeIndex *index = attribute->GetIndex())
uint8 oldKey[kMaxIndexKeyLength]; index->Removed(attribute);
size_t oldLength;
attribute->GetKey(oldKey, &oldLength); // update live queries
UpdateLiveQueries(NULL, attribute->GetNode(), attribute->GetName(), if (attribute->GetNode() != NULL) {
attribute->GetType(), oldKey, oldLength, NULL, 0); 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;
} }