summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-01-08 18:57:37 +0100
committerAndreas Kling <kling@serenityos.org>2022-01-08 19:38:00 +0100
commit01823746e30c936eb7cd80becad615dbdd5485ae (patch)
treebb006f816535b4ef45149c2e15ea955f0c1e25f0 /Kernel/FileSystem
parenta99685ece786cdefcb99501a539462f9e63ac66d (diff)
downloadserenity-01823746e30c936eb7cd80becad615dbdd5485ae.zip
Kernel: Remove redundant disk cache dirty flag in BlockBasedFileSystem
The disk cache is dirty if the dirty list has entries. No need to track this in a separate flag.
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r--Kernel/FileSystem/BlockBasedFileSystem.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/Kernel/FileSystem/BlockBasedFileSystem.cpp b/Kernel/FileSystem/BlockBasedFileSystem.cpp
index cf2916d3d1..8ca96ab2d1 100644
--- a/Kernel/FileSystem/BlockBasedFileSystem.cpp
+++ b/Kernel/FileSystem/BlockBasedFileSystem.cpp
@@ -34,20 +34,17 @@ public:
~DiskCache() = default;
- bool is_dirty() const { return m_dirty; }
- void set_dirty(bool b) { m_dirty = b; }
+ bool is_dirty() const { return !m_dirty_list.is_empty(); }
void mark_all_clean()
{
while (auto* entry = m_dirty_list.first())
m_clean_list.prepend(*entry);
- m_dirty = false;
}
void mark_dirty(CacheEntry& entry)
{
m_dirty_list.prepend(entry);
- m_dirty = true;
}
void mark_clean(CacheEntry& entry)
@@ -101,7 +98,6 @@ private:
mutable IntrusiveList<&CacheEntry::list_node> m_dirty_list;
NonnullOwnPtr<KBuffer> m_cached_block_data;
NonnullOwnPtr<KBuffer> m_entries;
- bool m_dirty { false };
};
BlockBasedFileSystem::BlockBasedFileSystem(OpenFileDescription& file_description)