1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

Kernel: Turns global Custody and Inode tables into InlineLinkedLists

Yet more of this same thing. Each one of these patches has a small but
noticeable impact on the steady-state kmalloc numbers. :^)
This commit is contained in:
Andreas Kling 2019-08-08 11:08:27 +02:00
parent 07425580a8
commit 318068fe1b
5 changed files with 34 additions and 21 deletions

View file

@ -4,18 +4,18 @@
#include <Kernel/FileSystem/Inode.h>
#include <Kernel/Lock.h>
static Lockable<HashTable<Custody*>>& all_custodies()
static Lockable<InlineLinkedList<Custody>>& all_custodies()
{
static Lockable<HashTable<Custody*>>* table;
if (!table)
table = new Lockable<HashTable<Custody*>>;
return *table;
static Lockable<InlineLinkedList<Custody>>* list;
if (!list)
list = new Lockable<InlineLinkedList<Custody>>;
return *list;
}
Custody* Custody::get_if_cached(Custody* parent, const String& name)
{
LOCKER(all_custodies().lock());
for (auto& custody : all_custodies().resource()) {
for (auto* custody = all_custodies().resource().head(); custody; custody = custody->next()) {
if (custody->is_deleted())
continue;
if (custody->is_mounted_on())
@ -47,7 +47,7 @@ Custody::Custody(Custody* parent, const String& name, Inode& inode)
, m_inode(inode)
{
LOCKER(all_custodies().lock());
all_custodies().resource().set(this);
all_custodies().resource().append(this);
}
Custody::~Custody()