Docs · Context FS

Inside Context FS.

Context FS is three layers of code: a client library shared by the FUSE daemon and the interceptors, the filesystem and stream modules in the runtime, and the CTE underneath. This page names the pieces and what each owns. The Filesystem and FUSE design page covers every operation and the consistency model in depth.

Modules
filesystem, stream
Daemon
clio_cte_fuse
Page size
1 MiB blobs
Directory block split
1024 entries

The pieces

FUSE daemonlibfuse3, macFUSE, WinFsp InterceptorsPOSIX, STDIO, MPI-IO, HDF5 VFD C++ APIfilesystem client directly Filesystem client librarydescriptor table · synchronous writes · zero-IPC read and stat mirrors Filesystem moduledirectory blocks, inodes, handles, leases Stream modulesizes, appends File pagesgo straight down CTE chain (indexer → … → cores)page blobs and directory-block blobs, tiered and replicated alike; inode records as tag attributes
Namespace operations go to the filesystem module, sizes and appends to the stream module, and file pages straight to the CTE chain.

How the namespace is stored

Tag of directory /atag id = inode number; it names the home node ~i · inode record (tag attribute)type, mode, owner, times, link count, parent INODE-TABLE BLOCKS (one blob each) d.0 · depth 2 x → #17 · file · livey → #23 · directory · livex2 → #17 · file · live (a hard link: same id) d.1 · depth 1keys with bit 0 set d.2 · born at 2split off d.0 by bit 1 At 1024 rows a block splits by the next hash bit;blocks never merge. Home of block k: hash(dir, "d.k").Row states: live, pending (invisible), leaving (frozen). Tag of file /a/x (#17)home: the node its id names ~i · inode record (tag attribute)type, mode, owner, times, link count, size snapshot PAGE BLOBS (1 MiB each, named by index) 0 1 2 · hole 3 A missing page is a hole and reads as zeros. Each pageis placed by the CTE's per-blob hash, so one largefile spreads over every node. Logical size and append orderowned by the stream module, not by the pages Extended-attribute tag (one per volume)one blob per inode, named by its id, holding all of its xattrs; kept out of the file's tag so st_size stays exact
Every file, directory and symbolic link is a CTE tag. Names live in the parent directory's inode-table blocks, which are blobs; attributes live in the inode's own record, a tag attribute. Because a name row only points at an id, a hard link is simply a second row.

Caches and homes

NODE A Client processFUSE daemon, interceptor or C++ API Descriptor tableopen file → handle from its homereads, writes and close go there Page writesone put per 1 MiB page rangesynchronous; errors return at write Shared-memory mirrorpath → tag id, logical size, mode, ownercomplete directory: a miss is ENOENT, no task pathoperations Filesystem container Inodes it homesattributes, who caches Directory journalblock images + deltas Inode-table blockshome blocks: the one writable copy, journaledother blocks: copies served under a 10 s lease,kept current by the home's pushesevery path walk resolves here Stream containerlogical sizes, append order (home) · staged appends (origin) NODE B Clientssame piecesas on node A Filesystem containerhome of block d.1 of /a,its only writer; sendseach change to everycopy before itacknowledges it CTE chain (indexer → … → cores)file pages, table blocks and xattr blobs: tiered, logged, replicated · inode records: tag attributes
There is no metadata server. Path operations go to the local filesystem container, which walks the path through its copies of the directory blocks; a block's home pushes every change to the nodes holding a copy before it acknowledges, so a warm walk needs no network round trip. Clients skip the runtime entirely for a warm stat or a miss in a complete directory, and batch small writes before sending them.

The client library

The FUSE daemon, the preloaded interceptors and the C++ API share one client library, so they behave the same. It keeps:

  • A descriptor table mapping open files to the handle the inode's home node issued, so reads, writes and close go straight to that node.
  • Synchronous writes: each write is stored before it returns, as one put per 1 MiB page range. Errors therefore return from the write that caused them.
  • Read and stat mirrors in shared memory, published by the runtime, so a warm stat or a read of a local RAM page needs no task at all.

The filesystem and stream modules

Every object is a tag
Each file, directory and symbolic link is a CTE tag. The tag id is the inode number and encodes the node that serves it, its home.
Files
Data lives in the file's tag as 1 MiB page blobs named by index; a missing page is a hole. A small inode record, stored as an attribute of the file's own tag, holds type, mode, owner, times, link count and a size snapshot. Extended attributes live in one global tag.
Directories
Entries live in directory-block blobs placed by name hash. A block over 1024 entries splits by the next hash bit; blocks never merge. Each entry is live, pending or leaving, which lets multi-step operations abort cleanly after a crash.
Sizes and appends
The stream module holds each file's logical size and orders concurrent appends from many nodes by staging them, then merging them in one order.
Local path resolution
Every path request goes to the local filesystem container, which walks the path from its cache of directory blocks. Blocks it does not own are fetched once, and the owner pushes later changes to it, so a warm walk costs no network round trip.
Leases
Cached namespace state is valid only under a lease, so a partitioned node can delay mutations but cannot serve stale names.

Crash safety

The filesystem and stream modules keep their node-local metadata in an append-only, self-checking record log: one write per mutation, replayed at startup with a torn tail cut off, then compacted. Operations are ordered so a crash leaks space rather than corrupting: the inode record is stored before its name appears, and link counts rise before links do. Directory blocks are ordinary CTE blobs, so the CTE's metadata log and replication protect them like file data. Inode records are tag attributes, which the replication module does not copy; instead the filesystem module mirrors each record, best effort, to the node that takes over the inode when its home is down.

The FUSE daemon

clio_cte_fuse is a runtime client. It translates kernel requests into client-library calls, configures the kernel's attribute and entry caches (see the FUSE daemon), and writes pages straight to the CTE chain and reads through the mirror fast paths. Those fast paths are single-node: on a multi-node mount, appends are staged and merged through the stream module.

Costs of this design

DecisionBuysCosts
Everything is a blobOne tiering, replication and durability mechanism for data and metadataMetadata blobs consume tier space and logging like data
Synchronous page writesErrors appear at the write that caused themEvery write waits for its pages to be stored
Multi-step renameNo distributed transactionsIntermediate states exist, though invisible or harmless
LeasesNever staleMutations can stall behind a partitioned holder

See Filesystem and FUSE for each operation step by step.