Kernel: Improve locking in Process, VFS and ATAController
We used to block on all process access. This meant that shell reading the keyboard input would block all VFS access making disk accesses practically impossible. We now block only when it is necessary :)
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <BAN/HashMap.h>
|
||||
#include <BAN/String.h>
|
||||
#include <BAN/StringView.h>
|
||||
#include <BAN/Vector.h>
|
||||
#include <kernel/FS/FileSystem.h>
|
||||
#include <kernel/Storage/StorageController.h>
|
||||
#include <kernel/SpinLock.h>
|
||||
|
||||
namespace Kernel
|
||||
{
|
||||
@@ -16,9 +15,10 @@ namespace Kernel
|
||||
static VirtualFileSystem& get();
|
||||
virtual ~VirtualFileSystem() {};
|
||||
|
||||
virtual BAN::RefPtr<Inode> root_inode() override { return m_root_fs->root_inode(); }
|
||||
virtual BAN::RefPtr<Inode> root_inode() override { return m_root_fs->root_inode(); }
|
||||
|
||||
BAN::ErrorOr<void> mount(BAN::StringView, BAN::StringView);
|
||||
BAN::ErrorOr<void> mount(FileSystem*, BAN::StringView);
|
||||
|
||||
struct File
|
||||
{
|
||||
@@ -29,7 +29,6 @@ namespace Kernel
|
||||
|
||||
private:
|
||||
VirtualFileSystem() = default;
|
||||
BAN::ErrorOr<void> mount(FileSystem*, BAN::StringView);
|
||||
|
||||
struct MountPoint
|
||||
{
|
||||
@@ -39,9 +38,9 @@ namespace Kernel
|
||||
MountPoint* mount_point_for_inode(BAN::RefPtr<Inode>);
|
||||
|
||||
private:
|
||||
SpinLock m_lock;
|
||||
FileSystem* m_root_fs = nullptr;
|
||||
BAN::Vector<MountPoint> m_mount_points;
|
||||
BAN::Vector<StorageController*> m_storage_controllers;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -41,7 +41,7 @@ namespace Kernel
|
||||
|
||||
BAN::ErrorOr<BAN::Vector<BAN::String>> read_directory_entries(int);
|
||||
|
||||
BAN::String working_directory() const;
|
||||
BAN::ErrorOr<BAN::String> working_directory() const;
|
||||
BAN::ErrorOr<void> set_working_directory(BAN::StringView);
|
||||
|
||||
static BAN::RefPtr<Process> current() { return Thread::current().process(); }
|
||||
|
||||
@@ -87,6 +87,7 @@ namespace Kernel
|
||||
private:
|
||||
ATABus m_buses[2];
|
||||
const PCIDevice& m_pci_device;
|
||||
SpinLock m_lock;
|
||||
|
||||
friend class ATADevice;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user