Kernel: Ext2 directories can allocate new blocks if needed

This commit is contained in:
Bananymous 2023-09-08 10:23:16 +03:00
parent 5d67559e33
commit 5887f6bcaa
2 changed files with 5 additions and 4 deletions

View File

@ -1,7 +1,7 @@
#include <BAN/ScopeGuard.h>
#include <kernel/FS/Ext2/FileSystem.h>
#define EXT2_DEBUG_PRINT 1
#define EXT2_DEBUG_PRINT 0
#define EXT2_VERIFY_INODE 0
namespace Kernel

View File

@ -164,7 +164,7 @@ namespace Kernel
ASSERT(mode().iflnk());
if (m_inode.size < sizeof(m_inode.block))
return BAN::String((const char*)m_inode.block);
ASSERT_NOT_REACHED();
return BAN::Error::from_errno(ENOTSUP);
}
BAN::ErrorOr<size_t> Ext2Inode::read(size_t offset, void* buffer, size_t count)
@ -486,8 +486,6 @@ namespace Kernel
}
needs_new_block:
ASSERT_NOT_REACHED();
block_index = TRY(allocate_new_block());
m_fs.read_block(block_index, block_buffer.span());
@ -511,6 +509,9 @@ needs_new_block:
return res.release_error();
}
if (mode().ifdir())
m_inode.size += blksize();
TRY(sync());
return new_block_index;
}