kernel/fs: Fix generation reference in EntryCache.
We are trying to add the enty to the current generation, so we need to use the current generation's next_index, not the previous. This was apparently broken since this code was imported. The "miss" here meant we always acquired the write-lock and then ran the more expensive add operation, which performs this same check (correctly). Slight performance improvement seen in basic testing, but nothing too drastic.
This commit is contained in:
@@ -189,7 +189,7 @@ EntryCache::Lookup(ino_t dirID, const char* name, ino_t& _nodeID,
|
||||
entry->index = kEntryNotInArray;
|
||||
|
||||
// add to the current generation
|
||||
const int32 index = atomic_add(&fGenerations[oldGeneration].next_index, 1);
|
||||
const int32 index = atomic_add(&fGenerations[fCurrentGeneration].next_index, 1);
|
||||
if (index < fGenerations[fCurrentGeneration].entries_size) {
|
||||
fGenerations[fCurrentGeneration].entries[index] = entry;
|
||||
entry->index = index;
|
||||
|
||||
Reference in New Issue
Block a user