3 ms·
I would assume cp uses ioctl (with atomic copies of individual files on filesystems that support CoW like APFS and BTRFS), whereas sqlite probably uses mmap?
by ummonk 1y ago
I would assume cp uses ioctl (with atomic copies of individual files on filesystems that support CoW like APFS and BTRFS), whereas sqlite probably uses mmap?
- vlovich123 1y agoI was trying to find evidence that reflink copies are atomic and could not and LLMs seem to think they are not. So at best may be a btrfs only feature?
- creatonez 1y agoFrom Linux kernel documentation: https://man7.org/linux/man-pages/man2/ioctl_ficlone.2.html https://man7.org/linux/man-pages/man2/ioctl_ficlone.2.html > Clones are atomic with regards to concurrent writes, so no locks need to be taken to obtain a consistent cloned copy. I'm not aware of any of the filesystems that use it (Btrfs, XFS, Bcachefs, ZFS) that deviate from expected atomic behavior, at least with single files being the atom in question for `FICLONE` operation.
- vlovich123 1y agoThanks! I similarly thought that a file clone would work but I couldn't confirm it.
- lmz 1y agoSo not a "naive" cp, but at least it calls a shared ioctl that is implemented buy multiple filesystems.