FUSE writeback-cache
FUSE writeback-cache is a negotiated mode that buffers file writes in the kernel page cache before forwarding them to a userspace filesystem.
With partial overwrites the daemon may need to serve reads even for a write-only open. [2] External writers require an explicit coherence design, and enabling the mode alone does not provide one. [1]
The mode is negotiated with the FUSE_WRITEBACK_CACHE flag, bit 16 of the FUSE_INIT flags, added in protocol version 7.23. [4] Dirty pages are written back in the background, under memory pressure, or on close, fsync and the last munmap. Because the kernel keeps size and timestamps current, the mode is generally unsuitable for network filesystems. [1]
In Linux v6.16 a connection that negotiates writeback caching does not get passthrough, because the current design does not handle both together. [5]
Relations
- related
- FUSE, Page cache, Write-back cache, Buffered I/O
Advantages
- write(2) can often complete quickly, because writes go to the cache first. [1]
Limitations
- If the filesystem stores timestamps more coarsely than nanoseconds, times can appear to change after a cache flush. [6]
Citations
- Linux v6.12: FUSE I/O modes
- libfuse 3.16.2: low-level open, flush, release and fsync contracts
- Linux v6.16 include/uapi/linux/fuse.h: FUSE_WRITEBACK_CACHE and protocol history
- Linux v6.16 fs/fuse/inode.c: FUSE_INIT reply processing
- libfuse 3.16.2 include/fuse_common.h: writeback cache capability and timestamps
Further reading
Sources & caveats
- fuse-modes is the Linux v6.12 FUSE I/O modes page, reread on the access date. Its text is identical at tag v6.16.
- fuse-uapi is include/uapi/linux/fuse.h at tag v6.16, read in the version history and the FUSE_INIT flag definitions.
- fuse-init-src is fs/fuse/inode.c at tag v6.16, read in process_init_reply.
- libfuse-common is include/fuse_common.h at fuse-3.16.2, read for FUSE_CAP_WRITEBACK_CACHE and time_gran.
- Bit 16 and 7.23 come from fuse-uapi.