diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-27 17:30:32 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-27 17:30:32 +0200 |
commit | 52139a2392a662bff23ee951579dea2d06fb18b8 (patch) | |
tree | 698b80b8cd0a3e3d47b4cf63fa9516d324c8ac13 /Kernel/FileSystem | |
parent | dde8d90747712d7bca65bf1471143a35bf71040d (diff) | |
download | serenity-52139a2392a662bff23ee951579dea2d06fb18b8.zip |
DiskBackedFS: Flush write cache if it reaches 32 entries before sync.
This is just to avoid chewing through all of the kernel memory. There is a
lot of room for improvement here, and 32 is just a number from the place
where numbers come from.
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r-- | Kernel/FileSystem/DiskBackedFileSystem.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Kernel/FileSystem/DiskBackedFileSystem.cpp b/Kernel/FileSystem/DiskBackedFileSystem.cpp index 4d45aabc01..fe241e99d3 100644 --- a/Kernel/FileSystem/DiskBackedFileSystem.cpp +++ b/Kernel/FileSystem/DiskBackedFileSystem.cpp @@ -69,6 +69,10 @@ bool DiskBackedFS::write_block(unsigned index, const ByteBuffer& data) LOCKER(m_lock); m_write_cache.set(index, data.isolated_copy()); + + if (m_write_cache.size() >= 32) + flush_writes(); + return true; } |