1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 11:17:44 +00:00

Kernel: Implement O_DIRECT open() flag to bypass disk caches

Files opened with O_DIRECT will now bypass the disk cache in read/write
operations (though metadata operations will still hit the disk cache.)

This will allow us to test actual disk performance instead of testing
disk *cache* performance, if that's what we want. :^)

There's room for improvment here, we're very aggressively flushing any
dirty cache entries for the specific block before reading/writing that
block. This is done by walking the entire cache, which may be slow.
This commit is contained in:
Andreas Kling 2019-11-05 19:35:12 +01:00
parent 3de3daf765
commit 59ed235c85
7 changed files with 59 additions and 18 deletions

View file

@ -44,6 +44,8 @@ public:
String absolute_path() const;
bool is_direct() const { return m_direct; }
bool is_directory() const { return m_is_directory; }
File& file() { return *m_file; }
@ -117,5 +119,6 @@ private:
bool m_is_blocking { true };
bool m_is_directory { false };
bool m_should_append { false };
bool m_direct { false };
FIFO::Direction m_fifo_direction { FIFO::Direction::Neither };
};