3 ms·
> (I wonder though what API the "cp" command would use to accomplish that). link(2)
by dom0 10y ago
> (I wonder though what API the "cp" command would use to accomplish that).
link(2)
- icebraining 10y agoThat's not copy-on-write, that's just giving an extra name to the same underlying file/inode.
- dom0 10y agoIt isn't (though it is CoW towards atomic file writing), and my comment was a bit tongue-in-cheek, since there really is nothing close to a portable API to do that. Linux recently gained a copy_file_range syscall which is part of the VFS - so a CoW FS or an FS with extent sharing should be able to implement the expected semantics here. Linux also has a bunch of ioctls that directly manipulate extents, like the FICLONERANGE mentioned above or FIDEDUPERANGE. For these to work reliably you need a lot of not-easily available information (in the general case)... these interfaces are comparable in application impl complexity to, say, O_DIRECT.