1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:08:12 +00:00

Kernel/FileSystem: Mark ext2 inode block list non-const

The block list required a bit of work, and now the only method being
declared const to bypass its const-iness is the read_bytes method that
calls a new method called compute_block_list_with_exclusive_locking that
takes care of proper locking before trying to update the block list data
of the ext2 inode.
This commit is contained in:
Liav A 2022-08-06 18:24:21 +03:00 committed by Idan Horowitz
parent 843bd43c5b
commit 4f4717e351
2 changed files with 24 additions and 3 deletions

View file

@ -61,6 +61,8 @@ private:
ErrorOr<void> grow_triply_indirect_block(BlockBasedFileSystem::BlockIndex, size_t, Span<BlockBasedFileSystem::BlockIndex>, Vector<BlockBasedFileSystem::BlockIndex>&, unsigned&);
ErrorOr<void> shrink_triply_indirect_block(BlockBasedFileSystem::BlockIndex, size_t, size_t, unsigned&);
ErrorOr<void> flush_block_list();
ErrorOr<void> compute_block_list_with_exclusive_locking();
ErrorOr<Vector<BlockBasedFileSystem::BlockIndex>> compute_block_list() const;
ErrorOr<Vector<BlockBasedFileSystem::BlockIndex>> compute_block_list_with_meta_blocks() const;
ErrorOr<Vector<BlockBasedFileSystem::BlockIndex>> compute_block_list_impl(bool include_block_list_blocks) const;
@ -70,9 +72,11 @@ private:
Ext2FS const& fs() const;
Ext2FSInode(Ext2FS&, InodeIndex);
mutable Vector<BlockBasedFileSystem::BlockIndex> m_block_list;
Vector<BlockBasedFileSystem::BlockIndex> m_block_list;
HashMap<NonnullOwnPtr<KString>, InodeIndex> m_lookup_cache;
ext2_inode m_raw_inode {};
Mutex m_block_list_lock { "BlockList"sv };
};
class Ext2FS final : public BlockBasedFileSystem {