ioctl_ficlonerange.2: Minor tweaks

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2016-06-08 12:17:02 +02:00
parent 1d691addc2
commit 603fc95a2b
1 changed files with 20 additions and 18 deletions

View File

@ -30,10 +30,10 @@ ioctl_ficlonerange, ioctl_ficlone \- share some the data of one file with anothe
If a filesystem supports files sharing physical storage between multiple If a filesystem supports files sharing physical storage between multiple
files ("reflink"), this files ("reflink"), this
.BR ioctl (2) .BR ioctl (2)
system call can be used to make some of the data in the operation can be used to make some of the data in the
.B src_fd .I src_fd
file appear in the file appear in the
.B dest_fd .I dest_fd
file by sharing the underlying storage, which is faster than making a separate file by sharing the underlying storage, which is faster than making a separate
physical copy of the data. physical copy of the data.
If a file write should occur to a shared region, If a file write should occur to a shared region,
@ -58,10 +58,10 @@ the following form:
.nf .nf
struct file_clone_range { struct file_clone_range {
__s64 src_fd; __s64 src_fd;
__u64 src_offset; __u64 src_offset;
__u64 src_length; __u64 src_length;
__u64 dest_offset; __u64 dest_offset;
}; };
.fi .fi
@ -69,7 +69,9 @@ struct file_clone_range {
Clones are atomic with regards to concurrent writes, so no locks need to be Clones are atomic with regards to concurrent writes, so no locks need to be
taken to obtain a consistent cloned copy. taken to obtain a consistent cloned copy.
The FICLONE ioctl clones entire files. The
.B FICLONE
ioctl clones entire files.
.SH RETURN VALUE .SH RETURN VALUE
On error, \-1 is returned, and On error, \-1 is returned, and
.I errno .I errno
@ -89,18 +91,18 @@ regions in directories.
.B EINVAL .B EINVAL
The filesystem does not support reflinking the ranges of the given files. The filesystem does not support reflinking the ranges of the given files.
This error can also appear if either file descriptor represents This error can also appear if either file descriptor represents
a device, fifo, or socket. a device, FIFO, or socket.
Disk filesystems generally require the offset and length arguments Disk filesystems generally require the offset and length arguments
to be aligned to the fundamental block size. to be aligned to the fundamental block size.
XFS and btrfs do not support XFS and Btrfs do not support
overlapping reflink ranges in the same file. overlapping reflink ranges in the same file.
.TP .TP
.B EBADF .B EBADF
.IR src_fd .IR src_fd
is not open for reading; is not open for reading;
.IR dest_fd .IR dest_fd
is not open for writing or is open for append-only writes; or the filesystem is not open for writing or is open for append-only writes;
which or the filesystem which
.IR src_fd .IR src_fd
resides on does not support reflink. resides on does not support reflink.
.TP .TP
@ -115,17 +117,17 @@ Swap files cannot share storage.
.B EOPNOTSUPP .B EOPNOTSUPP
This can appear if the filesystem does not support reflinking either file This can appear if the filesystem does not support reflinking either file
descriptor. descriptor.
.SH NOTES
Because a copy on write operation requires the allocation of new storage, the
.B fallocate (2)
operation may un-share shared blocks to guarantee that subsequent writes will
not fail because of lack of disk space.
.SH CONFORMING TO .SH CONFORMING TO
This API is Linux-specific. This API is Linux-specific.
This ioctl was previously known as This ioctl was previously known as
.B BTRFS_IOC_CLONE_RANGE .B BTRFS_IOC_CLONE_RANGE
and was private to btrfs. and was private to Btrfs.
.fi .fi
.in .in
.SH NOTES
Because a copy-on-write operation requires the allocation of new storage, the
.BR fallocate (2)
operation may unshare shared blocks to guarantee that subsequent writes will
not fail because of lack of disk space.
.SH SEE ALSO .SH SEE ALSO
.BR ioctl (2) .BR ioctl (2)