Kernel: Remove the big inode lock

This moves locking to the inodes themselves which allows reducing lock
times significantly. Main inodes (ext2 and tmpfs) still do contain a
single big mutex that gets locked during operations but now we have the
architecture to optimize these.
This commit is contained in:
2026-05-09 21:30:05 +03:00
parent a7356716ff
commit 9f4271f6d8
31 changed files with 378 additions and 189 deletions

View File

@@ -1,5 +1,6 @@
#include <kernel/CPUID.h>
#include <kernel/Debug.h>
#include <kernel/Lock/SpinLock.h>
#include <kernel/Random.h>
#include <kernel/Timer/Timer.h>
@@ -9,6 +10,7 @@ namespace Kernel
// Constants and algorithm from https://en.wikipedia.org/wiki/Permuted_congruential_generator
static SpinLock s_rand_lock;
static uint64_t s_rand_seed = 0x4d595df4d0f33173;
static constexpr uint64_t s_rand_multiplier = 6364136223846793005;
static constexpr uint64_t s_rand_increment = 1442695040888963407;
@@ -46,7 +48,9 @@ namespace Kernel
uint32_t Random::get_u32()
{
auto rotr32 = [](uint32_t x, unsigned r) { return x >> r | x << (-r & 31); };
constexpr auto rotr32 = [](uint32_t x, unsigned r) { return x >> r | x << (-r & 31); };
SpinLockGuard _(s_rand_lock);
uint64_t x = s_rand_seed;
unsigned count = (unsigned)(x >> 59);