kernel/EntryCache: Always resize if needed in _AddEntryToCurrentGeneration.

Otherwise, the only place we resize the table is Remove(), and if
that doesn't get called (because no files are being deleted) then
we will rarely, if ever, resize the table, leading to performance
issues.

Fixes a performance regression easily seen by running "grep -R".
This commit is contained in:
Augustin Cavalier
2025-08-30 12:36:35 -04:00
parent 23f75d5229
commit ff9a75a6f5
+4 -2
View File
@@ -243,6 +243,10 @@ EntryCache::_AddEntryToCurrentGeneration(EntryCacheEntry* entry, bool move)
readLocker.Unlock();
WriteLocker writeLocker(fLock);
// Resize the table if needed, no matter what. (The only other place it can
// be resized is Remove(), so this is important.)
fEntries.ResizeIfNeeded();
if (entry->index == kEntryRemoved) {
// the entry has been removed in the meantime
writeLocker.Unlock();
@@ -256,8 +260,6 @@ EntryCache::_AddEntryToCurrentGeneration(EntryCacheEntry* entry, bool move)
fGenerations[fCurrentGeneration].entries[index] = entry;
entry->generation = fCurrentGeneration;
entry->index = index;
fEntries.ResizeIfNeeded();
return true;
}