History

vfs: hoist the btrfs deduplication ioctl to the vfs

Hoist the btrfs EXTENT_SAME ioctl up to the VFS and make the name more systematic (FIDEDUPERANGE).

Darrick J. Wong committed 10 years ago

Commit 54dbc151 parent d79bdd55 files · +173 −0Browse files

Showing the changes to include/uapi (1 of 5 files). Show all

Unified · Split

include/uapi/linux/fs.h+30−0
@@ -52,6 +52,35 @@ struct fstrim_range { · 51 unmodified lines
5252 __u64 minlen;
5353 };
5454
55+/* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */
56+#define FILE_DEDUPE_RANGE_SAME 0
57+#define FILE_DEDUPE_RANGE_DIFFERS 1
58+
59+/* from struct btrfs_ioctl_file_extent_same_info */
60+struct file_dedupe_range_info {
61+ __s64 dest_fd; /* in - destination file */
62+ __u64 dest_offset; /* in - start of extent in destination */
63+ __u64 bytes_deduped; /* out - total # of bytes we were able
64+ * to dedupe from this file. */
65+ /* status of this dedupe operation:
66+ * < 0 for error
67+ * == FILE_DEDUPE_RANGE_SAME if dedupe succeeds
68+ * == FILE_DEDUPE_RANGE_DIFFERS if data differs
69+ */
70+ __s32 status; /* out - see above description */
71+ __u32 reserved; /* must be zero */
72+};
73+
74+/* from struct btrfs_ioctl_file_extent_same_args */
75+struct file_dedupe_range {
76+ __u64 src_offset; /* in - start of extent in source */
77+ __u64 src_length; /* in - length of extent */
78+ __u16 dest_count; /* in - total elements in info array */
79+ __u16 reserved1; /* must be zero */
80+ __u32 reserved2; /* must be zero */
81+ struct file_dedupe_range_info info[0];
82+};
83+
5584 /* And dynamically-tunable limits and defaults: */
5685 struct files_stat_struct {
5786 unsigned long nr_files; /* read only */
@@ -168,6 +197,7 @@ struct inodes_stat_t { · 110 unmodified lines
168197 #define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */
169198 #define FICLONE _IOW(0x94, 9, int)
170199 #define FICLONERANGE _IOW(0x94, 13, struct file_clone_range)
200+#define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range)
171201
172202 #define FS_IOC_GETFLAGS _IOR('f', 1, long)
173203 #define FS_IOC_SETFLAGS _IOW('f', 2, long)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t