From 52139a2392a662bff23ee951579dea2d06fb18b8 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 27 Apr 2019 17:30:32 +0200 Subject: 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. --- Kernel/FileSystem/DiskBackedFileSystem.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Kernel') 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; } -- cgit v1.2.3