Giampaolo Rodola' <g.rod...@gmail.com> added the comment:

I'm attaching an initial PoC using FICLONE on Linux and clonefile(3) on OSX. It 
is also possible to support Windows but it requires a ReFS partition to test 
against which I currently don't have.  I opted for exposing reflink() as a 
separate function, mostly because:

- conceptually standard copy and CoW copy are 2 different things
- shutil already provides a distinction between copy functions (copy(), 
copy2(), copyfile()) which can be used as callbacks for copytree() and move(). 
As such one can follow the same approach and do:

   >>> copytree(src, dst, copy_function=reflink).

This initial patch provides a callback=None parameter in case the CoW operation 
fails because not supported by the underlying filesystems but this is debatable 
because we can get different errors depending on the platform (which is not 
good). As such a more generic ReflinkNotSupportedError exception is probably a 
better choice.

----------
keywords: +patch
Added file: https://bugs.python.org/file48390/cow.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37157>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to