Automatically call Inode::flush_metadata() before an Inode is destroyed.

Use a little template magic to have Retainable::release() call out to
T::will_be_destroyed() if such a function exists before actually calling
the destructor. This gives us full access to virtual functions in the
pre-destruction code.
This commit is contained in:
Andreas Kling 2018-12-19 22:28:09 +01:00
parent 1f44cd9dd9
commit d0f06e5f3f
Notes: sideshowbarker 2024-07-19 16:07:58 +09:00
6 changed files with 41 additions and 17 deletions

View file

@ -317,6 +317,7 @@ void Ext2FSInode::flush_metadata()
m_raw_inode.i_dtime = m_metadata.dtime;
m_raw_inode.i_blocks = m_metadata.blockCount;
fs().write_ext2_inode(index(), m_raw_inode);
set_metadata_dirty(false);
}
RetainPtr<Inode> Ext2FS::get_inode(InodeIdentifier inode) const