mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-11 01:22:12 +02:00
Kernel: Allocate BlockBasedFilesystem caches upfront
This eliminates the possibility of panicking due to encountering a page fault while trying access the cache inside an interrupt handler.
This commit is contained in:
committed by
Sönke Holz
parent
036f7d5438
commit
6836d5bc01
@@ -126,8 +126,8 @@ ErrorOr<void> BlockBasedFileSystem::initialize_while_locked()
|
||||
VERIFY(m_lock.is_locked());
|
||||
VERIFY(!is_initialized_while_locked());
|
||||
VERIFY(logical_block_size() != 0);
|
||||
auto cached_block_data = TRY(KBuffer::try_create_with_size("BlockBasedFS: Cache blocks"sv, DiskCache::EntryCount * logical_block_size()));
|
||||
auto entries_data = TRY(KBuffer::try_create_with_size("BlockBasedFS: Cache entries"sv, DiskCache::EntryCount * sizeof(CacheEntry)));
|
||||
auto cached_block_data = TRY(KBuffer::try_create_with_size("BlockBasedFS: Cache blocks"sv, DiskCache::EntryCount * logical_block_size(), Memory::Region::Access::ReadWrite, AllocationStrategy::AllocateNow));
|
||||
auto entries_data = TRY(KBuffer::try_create_with_size("BlockBasedFS: Cache entries"sv, DiskCache::EntryCount * sizeof(CacheEntry), Memory::Region::Access::ReadWrite, AllocationStrategy::AllocateNow));
|
||||
auto disk_cache = TRY(adopt_nonnull_own_or_enomem(new (nothrow) DiskCache(*this, move(cached_block_data), move(entries_data))));
|
||||
|
||||
m_cache.with_exclusive([&](auto& cache) {
|
||||
|
||||
Reference in New Issue
Block a user