ioctl_fideduperange - Online Linux Manual PageSection : 2
Updated : 2022-10-30
Source : Linux man-pages 6.03
NAMEioctl_fideduperange − share some the data of one file with another file
LIBRARYStandard C library (libc, −lc)
SYNOPSIS#include <linux/fs.h> /* Definition of FIDEDUPERANGE and
FILE_DEDUPE_* constants*/
#include <sys/ioctl.h>int ioctl(int src_fd, FIDEDUPERANGE, struct file_dedupe_range *arg);
DESCRIPTIONIf a filesystem supports files sharing physical storage between multiple files, this ioctl(2) operation can be used to make some of the data in the src_fd file appear in the dest_fd file by sharing the underlying storage if the file data is identical ("deduplication"). Both files must reside within the same filesystem. This reduces storage consumption by allowing the filesystem to store one shared copy of the data. If a file write should occur to a shared region, the filesystem must ensure that the changes remain private to the file being written. This behavior is commonly referred to as "copy on write". This ioctl performs the "compare and share if identical" operation on up to src_length bytes from file descriptor src_fd at offset src_offset. This information is conveyed in a structure of the following form: struct file_dedupe_range {
__u64 src_offset;
__u64 src_length;
__u16 dest_count;
__u16 reserved1;
__u32 reserved2;
struct file_dedupe_range_info info[0];
};Deduplication is atomic with regards to concurrent writes, so no locks need to be taken to obtain a consistent deduplicated copy. The fields reserved1 and reserved2 must be zero. Destinations for the deduplication operation are conveyed in the array at the end of the structure. The number of destinations is given in dest_count, and the destination information is conveyed in the following form: struct file_dedupe_range_info {
__s64 dest_fd;
__u64 dest_offset;
__u64 bytes_deduped;
__s32 status;
__u32 reserved;
};Each deduplication operation targets src_length bytes in file descriptor dest_fd at offset dest_offset. The field reserved must be zero. During the call, src_fd must be open for reading and dest_fd must be open for writing. The combined size of the struct file_dedupe_range and the struct file_dedupe_range_info array must not exceed the system page size. The maximum size of src_length is filesystem dependent and is typically 16 MiB. This limit will be enforced silently by the filesystem. By convention, the storage used by src_fd is mapped into dest_fd and the previous contents in dest_fd are freed. Upon successful completion of this ioctl, the number of bytes successfully deduplicated is returned in bytes_deduped and a status code for the deduplication operation is returned in status. If even a single byte in the range does not match, the deduplication request will be ignored and status set to FILE_DEDUPE_RANGE_DIFFERS. The status code is set to FILE_DEDUPE_RANGE_SAME for success, a negative error code in case of error, or FILE_DEDUPE_RANGE_DIFFERS if the data did not match.
RETURN VALUEOn error, −1 is returned, and errno is set to indicate the error.
ERRORSPossible errors include (but are not limited to) the following: EBADF src_fd is not open for reading; dest_fd is not open for writing or is open for append-only writes; or the filesystem which src_fd resides on does not support deduplication. EINVAL The filesystem does not support deduplicating the ranges of the given files. This error can also appear if either file descriptor represents a device, FIFO, or socket. Disk filesystems generally require the offset and length arguments to be aligned to the fundamental block size. Neither Btrfs nor XFS support overlapping deduplication ranges in the same file. EISDIR One of the files is a directory and the filesystem does not support shared regions in directories. ENOMEM The kernel was unable to allocate sufficient memory to perform the operation or dest_count is so large that the input argument description spans more than a single page of memory. EOPNOTSUPP This can appear if the filesystem does not support deduplicating either file descriptor, or if either file descriptor refers to special inodes. EPERM dest_fd is immutable. ETXTBSY One of the files is a swap file. Swap files cannot share storage. EXDEV dest_fd and src_fd are not on the same mounted filesystem.
VERSIONSThis ioctl operation first appeared in Linux 4.5. It was previously known as BTRFS_IOC_FILE_EXTENT_SAME and was private to Btrfs.
STANDARDSThis API is Linux-specific.
NOTESBecause a copy-on-write operation requires the allocation of new storage, the fallocate(2) operation may unshare shared blocks to guarantee that subsequent writes will not fail because of lack of disk space. Some filesystems may limit the amount of data that can be deduplicated in a single call.
SEE ALSOioctl(2) 0
Johanes Gumabo
Data Size : 12,562 byte
man-ioctl_fideduperange.2Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 4 / 187,168
Visitor ID : :
Visitor IP : 18.119.28.173 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.