diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-25 22:05:53 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-25 22:05:53 +0200 |
commit | 44673c4f3b092f03ed8607b743903cf03d46b3f2 (patch) | |
tree | 79edb1852b226da711099e32dd1c775c22710fd0 /AK/ByteBuffer.h | |
parent | e0cdc5db0df929e202b69ff8df9029a564ff7a3c (diff) | |
download | serenity-44673c4f3b092f03ed8607b743903cf03d46b3f2.zip |
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. :^)
Diffstat (limited to 'AK/ByteBuffer.h')
-rw-r--r-- | AK/ByteBuffer.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index f263c1c13b..45b213713d 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -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) { |