1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:27:45 +00:00

Kernel: Add a write cache to DiskBackedFS.

This way you can spam small write()s on a file without the kernel writing
to disk every single time. Flushes are included in the FS::sync() operation
and will get triggered regularly by syncd. :^)
This commit is contained in:
Andreas Kling 2019-04-25 22:05:53 +02:00
parent e0cdc5db0d
commit 44673c4f3b
5 changed files with 49 additions and 13 deletions

View file

@ -118,6 +118,13 @@ public:
void* end_pointer() { return m_impl ? m_impl->end_pointer() : nullptr; }
const void* end_pointer() const { return m_impl ? m_impl->end_pointer() : nullptr; }
ByteBuffer isolated_copy() const
{
if (!m_impl)
return { };
return copy(m_impl->pointer(), m_impl->size());
}
// NOTE: trim() does not reallocate.
void trim(ssize_t size)
{