mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 14:43:01 +02: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:
Notes:
sideshowbarker
2024-07-19 11:22:09 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/59ed235c857
@@ -21,14 +21,15 @@ public:
|
||||
protected:
|
||||
explicit DiskBackedFS(NonnullRefPtr<DiskDevice>&&);
|
||||
|
||||
bool read_block(unsigned index, u8* buffer) const;
|
||||
bool read_blocks(unsigned index, unsigned count, u8* buffer) const;
|
||||
bool read_block(unsigned index, u8* buffer, FileDescription* = nullptr) const;
|
||||
bool read_blocks(unsigned index, unsigned count, u8* buffer, FileDescription* = nullptr) const;
|
||||
|
||||
bool write_block(unsigned index, const u8*);
|
||||
bool write_blocks(unsigned index, unsigned count, const u8*);
|
||||
bool write_block(unsigned index, const u8*, FileDescription* = nullptr);
|
||||
bool write_blocks(unsigned index, unsigned count, const u8*, FileDescription* = nullptr);
|
||||
|
||||
private:
|
||||
DiskCache& cache() const;
|
||||
void flush_specific_block_if_needed(unsigned index);
|
||||
|
||||
NonnullRefPtr<DiskDevice> m_device;
|
||||
mutable OwnPtr<DiskCache> m_cache;
|
||||
|
||||
Reference in New Issue
Block a user