How nafis-muktashid/crunchfs works
CrunchFS-2 is a FUSE filesystem that presents compressed, persistent files through a mount point. The documented workflow is: the daemon prepares the backing directory and starts FUSE; filesystem callbacks resolve logical paths, serve reads and writes, and update metadata and compressed chunks. Reads dispatch chunk work to a thread pool, while /.cfs_stats exposes storage totals. The active architecture is documented in the README; src/passthrough_cfs.cpp is a substantial separate implementation not listed in the current build architecture. Connections involving the unsampled compression wrapper are limited to relationships visible in the excerpts and source index.
Main entry points: fuse_ops.cpp FUSE operations · metadata.cpp Metadata index · main.cpp Daemon bootstrap · chunk_store.cpp Compressed chunks
Components 13
Mount runtime
- Daemon bootstrap
src/main.cpp - Worker pool
src/thread_pool.cpp
Filesystem operations
- FUSE operations
src/fuse_ops.cpp - File I/O callbacks
src/fuse_ops.cpp - Stats endpoint
src/fuse_ops.cpp
Persistent storage
- Metadata index
src/metadata.cpp - Compressed chunks
src/chunk_store.cpp - Compression wrapper
src/conpresslib.cpp - Codec interface
src/compression/interface.hpp - Zstd backend
src/compression/zstd_backend.cpp
Separate implementation
- Separate passthrough implementation
src/passthrough_cfs.cpp
Other components
- Filesystem user
- FUSE runtime
Connections 14
- Filesystem user → FUSE runtime: uses mount
README.md - Daemon bootstrap → FUSE runtime: starts
src/main.cpp - Daemon bootstrap → FUSE operations: registers
src/main.cpp - FUSE runtime → FUSE operations: dispatches callbacks
- FUSE operations → Metadata index: manages metadata
src/fuse_ops.cpp - FUSE operations → File I/O callbacks: handles file requests
src/fuse_ops.cpp - FUSE operations → Stats endpoint: serves stats
src/fuse_ops.cpp - File I/O callbacks → Metadata index: resolves paths
src/fuse_ops.cpp - File I/O callbacks → Compressed chunks: reads and writes
src/fuse_ops.cpp - File I/O callbacks → Worker pool: dispatches reads
src/fuse_ops.cpp - Stats endpoint → Metadata index: accumulates totals
src/fuse_ops.cpp - Compressed chunks → Compression wrapper: compresses chunks
src/chunk_store.cpp - Compression wrapper → Codec interface: uses codec API
- Codec interface → Zstd backend: implemented by
src/compression/zstd_backend.cpp