Skip to main content

Crate blob_pager_and_verifier

Crate blob_pager_and_verifier 

Source
Expand description

Coordinates pager-backed blob VMOs, driver-level page fault handling, and cryptographic verification.

§Overview

BlobPagerAndVerifier manages pager-backed VMOs for blobs. It decouples page fault servicing from the filesystem by having the block driver read and decompress raw disk blocks directly, while BlobPagerAndVerifier cryptographically verifies the pages before supplying them to the pager VMO to unblock client reads.

§Blob Opening and Caching

When a client requests a blob via create_vmo:

  • If already cached: Clones and returns a new read-only child VMO immediately.
  • If currently opening: Suspends until the in-flight request finishes, then clones and returns a child VMO once ready.
  • If not in cache: Registers the blob’s extent mappings with Fxfs, creates the pager-backed VMO, caches it, and returns a child VMO to the caller.

§Page Fault Handling and Verification

  1. When a client reads an unpopulated page, the kernel generates a page request on the pager port, which the block driver monitors directly.
  2. The driver reads and decompresses the disk blocks according to the blob’s extent mappings, then writes unverified pages and Merkle metadata into a shared delivery queue VMO.
  3. BlobPagerAndVerifier verifies the incoming pages against the blob’s Merkle tree:
    • On success, it supplies the verified pages to the pager VMO (zx_pager_supply_pages), unblocking the client read.
    • On verification failure, it fails the request with ZX_ERR_IO_DATA_INTEGRITY.

§Eviction and Teardown

  1. Clients receive read-only child VMOs cloned from the parent pager VMO.
  2. When all client handles to a blob are dropped, the kernel notifies the cache via ZX_VMO_ZERO_CHILDREN.
  3. The cache evicts the inactive blob and closes its mapping session with Fxfs, reclaiming driver extent tracking and kernel pager resources.

Structs§

BlobPagerAndVerifier
Coordinates between FxBlob, the block driver, and the kernel to manage pager-backed blobs such that page requests can be handled at the driver instead of the filesystem layer.
DeliveryQueueProcessor
TestVmoProvider
A simple in-memory DeliveryQueueProvider for testing delivery without Merkle verification.
UnverifiedPages
Unverified data pages delivered from the driver to be verified.

Constants§

DELIVERY_DATA_SIZE
The chunk size requirement for delivering payloads from the block driver across the delivery queue. The driver must supply DeliveryCommand::Data chunks where the target_offset and length align to DELIVERY_DATA_SIZE boundaries (unless representing the final chunk of the blob).

Traits§

DeliveryQueueProvider
Trait providing data delivery and blob metadata registration for incoming delivery commands.