ioctl: add note regarding CLONE_RANGE(len=0) behaviour
authorDavid Disseldorp <ddiss@suse.de>
Thu, 6 Feb 2014 14:29:18 +0000 (15:29 +0100)
committerChris Mason <clm@fb.com>
Fri, 21 Mar 2014 13:23:10 +0000 (06:23 -0700)
A BTRFS_IOC_CLONE_RANGE request with a src_length value of zero has the
effect of cloning all data from src_offset through to end-of-file.

Document this behaviour in the header file for those who (like me)
incorrectly assume that no data is cloned in such a case.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
ioctl.h

diff --git a/ioctl.h b/ioctl.h
index 2cf9c73..7f7e1d6 100644 (file)
--- a/ioctl.h
+++ b/ioctl.h
@@ -506,6 +506,7 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
 #define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, \
                                   struct btrfs_ioctl_vol_args)
 
+/* With a @src_length of zero, the range from @src_offset->EOF is cloned! */
 struct btrfs_ioctl_clone_range_args {
        __s64 src_fd;
        __u64 src_offset, src_length;