Haiku Rewind
Press Esc to go back
/projects/haiku-rewind
Copy-on-Write filesystem snapshots for Haiku's BFS. Point-in-time captures of your filesystem state - think Time Machine for Haiku, or ZFS/Btrfs snapshots.
Architecture
┌─────────────────────────────────────────────────────┐ │ User Space │ │ ┌──────────────┐ ┌──────────────┐ │ │ │ CLI Tool │ │ GUI Tool │ (Future) │ │ └──────┬───────┘ └──────┬───────┘ │ │ └─────────┬───────────┘ │ │ │ ioctl() │ ├───────────────────┼─────────────────────────────────┤ │ Kernel Space │ │ ┌─────────▼──────────┐ │ │ │ SnapshotManager │ Lifecycle & Control │ │ └─────────┬──────────┘ │ │ ┌─────────▼──────────┐ │ │ │ Snapshot │ Block Tracking │ │ │ - COW Logic │ │ │ └─────────┬──────────┘ │ │ ┌──────────────┼──────────────┐ │ │ ┌─▼────┐ ┌───▼────┐ ┌───▼─────┐ │ │ │Volume│ │ Inode │ │ Block │ │ │ └──────┘ └────────┘ │Allocator│ │ │ BFS Core └─────────┘ │ └─────────────────────────────────────────────────────┘
Key Features
Copy-on-Write
- Block-level COW mechanism
- Automatic duplication on write
- Efficient block mapping
- BFS BlockAllocator integration
Snapshot Management
- Up to 64 simultaneous snapshots
- Thread-safe operations
- Transaction integration
- Graceful init/shutdown
Implementation Status
Core:
100%
BFS Hooks:
100%
Build:
100%
Testing:
30%
CLI Tool:
0%
Progress Tracker
Done
- ~1,000 lines C++ implementation
- Volume/Inode/Superblock hooks
- Docker + Linux build system
- Cross-compiler toolchain
In Progress
- VM testing (Phase 1-2)
- Stability verification
- Documentation
Planned
- CLI tool (create/list/restore)
- Metadata persistence
- GUI snapshot browser
COW Write Flow
- Application writes to file
- Inode::WriteAt() intercepts the write
- SnapshotManager::CheckCOWRequirement() called
- For each modified block:
- Check if block already copied
- Allocate new COW block if needed
- Copy original → COW block
- Record mapping (original → COW)
- Allow write to proceed to original block
- Snapshot preserves old data in COW block