Expand description
Global Page Cache Manager
Provides a unified page cache for all filesystem operations (read/write/mmap). This cache is shared across all file objects pointing to the same file, ensuring consistency and memory efficiency.
§Phase 0 Implementation
Current implementation includes:
- Page allocation and caching with CacheId-based indexing
- Pin-based protection against eviction during active use
- Dirty page tracking for write operations
- Object-level locking for mmap support
- Flush operations for writeback
Not yet implemented:
- Page eviction (LRU or similar policy)
- LOADING state coordination for concurrent access
- Integration with filesystem read/write operations (Phase 1)
- Demand paging for mmap (Phase 2)
§Usage
use crate::mem::page_cache::PageCacheManager;
let paddr = PageCacheManager::global().get_or_create_pinned(cache_id, page_index, |paddr| {
// Load page content from disk to paddr
Ok(())
})?;
// Use the page...
PageCacheManager::global().unpin(cache_id, page_index);Structs§
- Page
Cache Entry - Entry in the page cache representing a single cached page
- Page
Cache Manager - Global page cache manager
- Pinned
Page - RAII guard for a pinned page.
Statics§
- GLOBAL_
PAGE_ CACHE - Global page cache instance
Type Aliases§
- Page
Index - Page index within a file (0, 1, 2, …)
- Physical
Address - Physical address of a page