Skip to main content

reflink_or_copy

Function reflink_or_copy 

Source
pub fn reflink_or_copy(src: &Path, dst: &Path) -> Result<u64>
Expand description

Copy src to dst using reflink (FICLONE) if supported, falling back to sendfile and finally a read+write loop. Returns bytes copied.

This is the synchronous small-file helper for code paths that cannot use the full async SmartCopier (e.g. snapshot creation, tree metadata copies). Never use std::fs::copy() – it bypasses CoW and reflink entirely.