aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2010-03-11 09:42:04 -0500
committerChris Mason <chris.mason@oracle.com>2010-03-15 11:00:10 -0400
commit1e701a3292e25a6c4939cad9f24951dc6b6ad853 (patch)
tree899887a99aae82fe113bffedccb90a76e5473f8b /fs/btrfs/ioctl.h
parent940100a4a7b78b27e60a3e72340fb9b5397dcdb2 (diff)
Btrfs: add new defrag-range ioctl.
The btrfs defrag ioctl was limited to doing the entire file. This commit adds a new interface that can defrag a specific range inside the file. It can also force compression on the file, allowing you to selectively compress individual files after they were created, even when mount -o compress isn't turned on. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ioctl.h')
-rw-r--r--fs/btrfs/ioctl.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h
index f1923e0260e3..2d64a65842f3 100644
--- a/fs/btrfs/ioctl.h
+++ b/fs/btrfs/ioctl.h
@@ -99,6 +99,35 @@ struct btrfs_ioctl_clone_range_args {
99 __u64 dest_offset; 99 __u64 dest_offset;
100}; 100};
101 101
102/* flags for the defrag range ioctl */
103#define BTRFS_DEFRAG_RANGE_COMPRESS 1
104#define BTRFS_DEFRAG_RANGE_START_IO 2
105
106struct btrfs_ioctl_defrag_range_args {
107 /* start of the defrag operation */
108 __u64 start;
109
110 /* number of bytes to defrag, use (u64)-1 to say all */
111 __u64 len;
112
113 /*
114 * flags for the operation, which can include turning
115 * on compression for this one defrag
116 */
117 __u64 flags;
118
119 /*
120 * any extent bigger than this will be considered
121 * already defragged. Use 0 to take the kernel default
122 * Use 1 to say every single extent must be rewritten
123 */
124 __u32 extent_thresh;
125
126 /* spare for later */
127 __u32 unused[5];
128};
129
130
102#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \ 131#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
103 struct btrfs_ioctl_vol_args) 132 struct btrfs_ioctl_vol_args)
104#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \ 133#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
@@ -130,6 +159,8 @@ struct btrfs_ioctl_clone_range_args {
130 struct btrfs_ioctl_vol_args) 159 struct btrfs_ioctl_vol_args)
131#define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \ 160#define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \
132 struct btrfs_ioctl_vol_args) 161 struct btrfs_ioctl_vol_args)
162#define BTRFS_IOC_DEFRAG_RANGE _IOW(BTRFS_IOCTL_MAGIC, 16, \
163 struct btrfs_ioctl_defrag_range_args)
133#define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \ 164#define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \
134 struct btrfs_ioctl_search_args) 165 struct btrfs_ioctl_search_args)
135#define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \ 166#define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \