GFile: Add Btrfs clone ioctl support
authorNirbheek Chauhan <nirbheek.chauhan@collabora.co.uk>
Sat, 5 Jan 2013 07:22:31 +0000 (12:52 +0530)
committerColin Walters <walters@verbum.org>
Sat, 5 Jan 2013 19:21:25 +0000 (14:21 -0500)
commit5eba9784979e0b723c05a45cf767046607e4e759
tree3353f1f1738b0be648223c0bbea27f8cbd461d94
parentf42347d82e3724958d36922a6171c2eb262336cb
GFile: Add Btrfs clone ioctl support

The attached patch adds support for the btrfs "clone" ioctl which
makes Copy-on-Write reflinks, resulting in cheap O(1) copies when
source/destination are on the same filesystem. The ioctl itself is
quite straightforward, and GNU coreutils has had support since 7.5
(--reflink=auto --sparse=auto).

The ioctl only operates on regular files and symlinks, and always
follows symlinks; checks have been added accordingly.

This patch would be very useful for everyone who uses btrfs
filesystems (Meego folks for instance). On systems that don't have
btrfs, or if the the source is not on a btrfs filesystem, the ioctl
returns EINVAL, and the fallback code is triggered. Hence this will
cause no problems for non-btrfs users.

https://bugzilla.gnome.org/show_bug.cgi?id=626497
configure.ac
gio/gfile.c