mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-25 17:15:44 +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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user