mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +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:
parent
e0cdc5db0d
commit
44673c4f3b
5 changed files with 49 additions and 13 deletions
|
@ -144,7 +144,7 @@ int Inode::decrement_link_count()
|
|||
|
||||
void FS::sync()
|
||||
{
|
||||
Vector<Retained<Inode>> inodes;
|
||||
Vector<Retained<Inode>, 32> inodes;
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
for (auto* inode : all_inodes()) {
|
||||
|
@ -157,6 +157,16 @@ void FS::sync()
|
|||
ASSERT(inode->is_metadata_dirty());
|
||||
inode->flush_metadata();
|
||||
}
|
||||
|
||||
Vector<Retained<FS>, 32> fses;
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
for (auto& it : all_fses())
|
||||
fses.append(*it.value);
|
||||
}
|
||||
|
||||
for (auto fs : fses)
|
||||
fs->flush_writes();
|
||||
}
|
||||
|
||||
void Inode::set_vmo(VMObject& vmo)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue