FALLOC_FL_UNSHARE_RANGE
FALLOC_FL_UNSHARE_RANGE makes shared file data private ahead of later writes, preserving existing content while preparing its copy-on-write allocation.
Allocation timing: a reflink postpones copying until a write diverges the files. This Linux fallocate mode brings that allocation forward for the selected range, trading immediate space and I/O for protection against later lack-of-space failures there. Success must be checked; unsupported filesystems can return EOPNOTSUPP and insufficient space can return ENOSPC. [1]
Mode boundaries: the Linux v6.16 UAPI assigns this flag 0x40 and describes content-preserving unsharing within file size. It belongs to allocation mode and cannot be combined with punch, zero, collapse or insert range modes. Filesystem-dependent granularity still applies. [2]
Checkpoint trade-off: famus_snap deliberately avoids reserving worst-case space for complete divergence of a backing file and its snapshot, because doing so could remove the sharing benefit. An application choosing that optimization must budget future copy-on-write growth separately. [3]
Persistence: allocating private extents does not flush future writes or durably publish a pathname. File synchronization and required directory synchronization remain separate obligations. [4]
Relations
- related
- Reflink, Copy-on-write (storage), File preallocation, File extent, fsync, Failure-atomic msync
Limitations
- An unshare failure is not a capacity reservation; inspect the error before relying on subsequent writes. [1]
- Neither private extents nor a cloned file provide an independent device-failure domain. [5]
Citations
- Linux man-pages: fallocate(2), unshare allocation mode and errors
- Linux v6.16: include/uapi/linux/falloc.h, unshare-range mode contract
- Terence Kelly. Good Old-Fashioned Persistent Memory. USENIX ;login:, Winter 2019, pp. 29-34.
- Linux man-pages: fsync(2), data, metadata and directory persistence
- Linux man-pages: FICLONE(2const), shared storage and later allocation
Further reading
Sources & caveats
- Source synthesis of Linux interface contracts and a snapshot implementation, not a filesystem benchmark or crash-recovery experiment.
- The flag's presence in a pinned UAPI header does not establish support on every filesystem or a date of first implementation.