mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 17:31:58 -05:00
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.
This commit is contained in:
parent
dde8d90747
commit
52139a2392
1 changed files with 4 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue