1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 20:05:07 +00:00

Kernel/FileSystem: Funnel calls to Inode::prepare_to_write_data method

Instead of requiring each FileSystem implementation to call this method
when trying to write data, do the calls at 2 points to avoid further
calls (or lack of them due to not remembering to use it) at other files
and locations in the codebase.
This commit is contained in:
Liav A 2022-07-27 21:42:16 +03:00 committed by Linus Groh
parent 38bf7863d0
commit fcc0e4d538
6 changed files with 12 additions and 11 deletions

View file

@ -253,9 +253,7 @@ void Inode::did_delete_self()
ErrorOr<void> Inode::prepare_to_write_data()
{
// FIXME: It's a poor design that filesystems are expected to call this before writing out data.
// We should funnel everything through an interface at the VirtualFileSystem layer so this can happen from a single place.
MutexLocker locker(m_inode_lock);
VERIFY(m_inode_lock.is_locked());
if (fs().is_readonly())
return EROFS;
auto metadata = this->metadata();