When I copy a file using reflink option, e.g.,
cp --reflink foo bar
how and what stage in execution of cp determines if the underneath file system supports COW. I tried looking into
coreutils/src/cp.c but couldn't find the specific system call/ ioctl or any other method which determines COW capability and accordingly proceeds for cp execution / reports error:
cp: failed to clone 'bar' from 'foo': Bad address
In short, I am looking for how resolution of
--reflink=auto option happens.