class PagedVfs
Defined at line 30 of file ../../src/storage/lib/vfs/cpp/paged_vfs.h
A variant of Vfs that supports paging. A PagedVfs supports PagedVnode objects.
Public Methods
void PagedVfs (async_dispatcher_t * dispatcher, int num_pager_threads)
The caller must call Init() which must succeed before using this class.
Defined at line 33 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
void ~PagedVfs ()
Defined at line 37 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
bool is_initialized ()
Defined at line 39 of file ../../src/storage/lib/vfs/cpp/paged_vfs.h
zx::result<> Init ()
Creates the pager and worker threads. If any of these fail, this class should not be used.
After calling Init, TearDown *must* be called before destroying.
Defined at line 76 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
void TearDown ()
TearDown should be called before PagedVfs is destroyed. It can be called from the derived
classes's destructor, but it should be on the class that is marked as final.
Defined at line 88 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
std::vector<zx::unowned_thread> GetPagerThreads ()
Gets the list of pager threads. This is designed to allow callers to set up scheduling profiles
on their pagers.
Defined at line 109 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
zx::result<> SupplyPages (const zx::vmo & node_vmo, uint64_t offset, uint64_t length, const zx::vmo & aux_vmo, uint64_t aux_offset)
Called in response to a successful PagedVnode::VmoRead() request, this supplies paged data from
aux_vmo to the PagedVnode's VMO to the kernel. See zx_pager_supply_pages() documentation for
more.
Defined at line 113 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
zx::result<> DirtyPages (const zx::vmo & node_vmo, uint64_t offset, uint64_t length)
Called in response to a successful PagedVnode::VmoDirty() request, this transits page state
from clean to dirty. See zx_pager_op_range() documentation for more.
Defined at line 118 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
zx::result<> ReportPagerError (const zx::vmo & node_vmo, uint64_t offset, uint64_t length, zx_status_t err)
Called in response to a failed PagedVnode::VmoRead() request, this reports that there was an
error populating page data. See zx_pager_op_range() documentation for more, only certain
values are permitted for err.
Defined at line 130 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
zx::result<> WritebackBegin (const zx::vmo & node_vmo, uint64_t offset, uint64_t length)
Notifies the kernel that the filesystem has started cleaning the `range` of pages. See
`ZX_PAGER_OP_WRITEBACK_BEGIN` for more information.
Defined at line 122 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
zx::result<> WritebackEnd (const zx::vmo & node_vmo, uint64_t offset, uint64_t length)
Notifies the kernel that the filesystem has finished cleaning the `range` of pages. See
`ZX_PAGER_OP_WRITEBACK_END` for more information.
Defined at line 126 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
zx::result<zx_pager_vmo_stats_t> QueryVmoStats (const zx::vmo & node_vmo, uint32_t options)
Checks if the VMO has been modified since the VMO was created or the last time this function
was called with the option `ZX_PAGER_RESET_VMO_STATS`.
Defined at line 135 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
zx::result<VmoCreateInfo> CreatePagedNodeVmo (PagedVnode * node, uint64_t size, uint32_t options)
Defined at line 143 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
void FreePagedVmo (VmoCreateInfo info)
When there is a VMO clone is alive, the PagedVnode should be registered with the VFS to handle
the paging requests for it.
PagedVnodes should unregister themselves and properly detach from the pager when being freed or
when their VMO handle is destroyed to prevent leaks or use-after-free errors. Detaching from
the pager is important because otherwise pager requests from any code that has mappings will
hang indefinitely.
The unique IDs are the ones generated by CreatePagedNodeVmo(). The vmo information should be
moved into this function, which will destroy the VMO handle after it's unregistered.
Defined at line 169 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
void PagerVmoRead (uint64_t node_id, uint64_t offset, uint64_t length)
Callback that the PagerThreadPool uses to notify us of pager events. These calls will get
issued on arbitrary threads.
Defined at line 188 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
void PagerVmoDirty (uint64_t node_id, uint64_t offset, uint64_t length)
Defined at line 214 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc
size_t GetRegisteredPagedVmoCount ()
Returns the number of VMOs registered for notifications. Used for testing.
Defined at line 236 of file ../../src/storage/lib/vfs/cpp/paged_vfs.cc