2 * Copyright (C) 2007 Oracle. All rights reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 * Boston, MA 021110-1307, USA.
19 #ifndef __BTRFS_IOCTL_H__
20 #define __BTRFS_IOCTL_H__
26 #include <asm/types.h>
27 #include <linux/ioctl.h>
33 #define BTRFS_IOCTL_MAGIC 0x94
34 #define BTRFS_VOL_NAME_MAX 255
36 /* this should be 4k */
37 #define BTRFS_PATH_NAME_MAX 4087
38 struct btrfs_ioctl_vol_args {
40 char name[BTRFS_PATH_NAME_MAX + 1];
42 BUILD_ASSERT(sizeof(struct btrfs_ioctl_vol_args) == 4096);
44 #define BTRFS_DEVICE_PATH_NAME_MAX 1024
46 #define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0)
47 #define BTRFS_SUBVOL_RDONLY (1ULL << 1)
48 #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2)
49 #define BTRFS_DEVICE_SPEC_BY_ID (1ULL << 3)
51 #define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED \
52 (BTRFS_SUBVOL_CREATE_ASYNC | \
53 BTRFS_SUBVOL_RDONLY | \
54 BTRFS_SUBVOL_QGROUP_INHERIT | \
55 BTRFS_DEVICE_SPEC_BY_ID)
57 #define BTRFS_FSID_SIZE 16
58 #define BTRFS_UUID_SIZE 16
60 #define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0)
62 struct btrfs_qgroup_limit {
69 BUILD_ASSERT(sizeof(struct btrfs_qgroup_limit) == 40);
71 struct btrfs_qgroup_inherit {
75 __u64 num_excl_copies;
76 struct btrfs_qgroup_limit lim;
79 BUILD_ASSERT(sizeof(struct btrfs_qgroup_inherit) == 72);
81 struct btrfs_ioctl_qgroup_limit_args {
83 struct btrfs_qgroup_limit lim;
85 BUILD_ASSERT(sizeof(struct btrfs_ioctl_qgroup_limit_args) == 48);
87 #define BTRFS_SUBVOL_NAME_MAX 4039
88 struct btrfs_ioctl_vol_args_v2 {
95 struct btrfs_qgroup_inherit __user *qgroup_inherit;
100 char name[BTRFS_SUBVOL_NAME_MAX + 1];
104 BUILD_ASSERT(sizeof(struct btrfs_ioctl_vol_args_v2) == 4096);
107 * structure to report errors and progress to userspace, either as a
108 * result of a finished scrub, a canceled scrub or a progress inquiry
110 struct btrfs_scrub_progress {
111 __u64 data_extents_scrubbed; /* # of data extents scrubbed */
112 __u64 tree_extents_scrubbed; /* # of tree extents scrubbed */
113 __u64 data_bytes_scrubbed; /* # of data bytes scrubbed */
114 __u64 tree_bytes_scrubbed; /* # of tree bytes scrubbed */
115 __u64 read_errors; /* # of read errors encountered (EIO) */
116 __u64 csum_errors; /* # of failed csum checks */
117 __u64 verify_errors; /* # of occurrences, where the metadata
118 * of a tree block did not match the
119 * expected values, like generation or
121 __u64 no_csum; /* # of 4k data block for which no csum
122 * is present, probably the result of
123 * data written with nodatasum */
124 __u64 csum_discards; /* # of csum for which no data was found
125 * in the extent tree. */
126 __u64 super_errors; /* # of bad super blocks encountered */
127 __u64 malloc_errors; /* # of internal kmalloc errors. These
128 * will likely cause an incomplete
130 __u64 uncorrectable_errors; /* # of errors where either no intact
131 * copy was found or the writeback
133 __u64 corrected_errors; /* # of errors corrected */
134 __u64 last_physical; /* last physical address scrubbed. In
135 * case a scrub was aborted, this can
136 * be used to restart the scrub */
137 __u64 unverified_errors; /* # of occurrences where a read for a
138 * full (64k) bio failed, but the re-
139 * check succeeded for each 4k piece.
140 * Intermittent error. */
143 #define BTRFS_SCRUB_READONLY 1
144 struct btrfs_ioctl_scrub_args {
145 __u64 devid; /* in */
146 __u64 start; /* in */
148 __u64 flags; /* in */
149 struct btrfs_scrub_progress progress; /* out */
151 __u64 unused[(1024-32-sizeof(struct btrfs_scrub_progress))/8];
153 BUILD_ASSERT(sizeof(struct btrfs_ioctl_scrub_args) == 1024);
155 #define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0
156 #define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID 1
157 struct btrfs_ioctl_dev_replace_start_params {
158 __u64 srcdevid; /* in, if 0, use srcdev_name instead */
159 __u64 cont_reading_from_srcdev_mode; /* in, see #define
161 __u8 srcdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1]; /* in */
162 __u8 tgtdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1]; /* in */
164 BUILD_ASSERT(sizeof(struct btrfs_ioctl_dev_replace_start_params) == 2072);
166 #define BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED 0
167 #define BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED 1
168 #define BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED 2
169 #define BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED 3
170 #define BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED 4
171 struct btrfs_ioctl_dev_replace_status_params {
172 __u64 replace_state; /* out, see #define above */
173 __u64 progress_1000; /* out, 0 <= x <= 1000 */
174 __u64 time_started; /* out, seconds since 1-Jan-1970 */
175 __u64 time_stopped; /* out, seconds since 1-Jan-1970 */
176 __u64 num_write_errors; /* out */
177 __u64 num_uncorrectable_read_errors; /* out */
179 BUILD_ASSERT(sizeof(struct btrfs_ioctl_dev_replace_status_params) == 48);
181 #define BTRFS_IOCTL_DEV_REPLACE_CMD_START 0
182 #define BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS 1
183 #define BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL 2
184 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT -1
185 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR 0
186 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED 1
187 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED 2
188 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS 3
189 struct btrfs_ioctl_dev_replace_args {
191 __u64 result; /* out */
194 struct btrfs_ioctl_dev_replace_start_params start;
195 struct btrfs_ioctl_dev_replace_status_params status;
200 BUILD_ASSERT(sizeof(struct btrfs_ioctl_dev_replace_args) == 2600);
202 struct btrfs_ioctl_dev_info_args {
203 __u64 devid; /* in/out */
204 __u8 uuid[BTRFS_UUID_SIZE]; /* in/out */
205 __u64 bytes_used; /* out */
206 __u64 total_bytes; /* out */
207 __u64 unused[379]; /* pad to 4k */
208 __u8 path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */
210 BUILD_ASSERT(sizeof(struct btrfs_ioctl_dev_info_args) == 4096);
212 struct btrfs_ioctl_fs_info_args {
213 __u64 max_id; /* out */
214 __u64 num_devices; /* out */
215 __u8 fsid[BTRFS_FSID_SIZE]; /* out */
216 __u32 nodesize; /* out */
217 __u32 sectorsize; /* out */
218 __u32 clone_alignment; /* out */
220 __u64 reserved[122]; /* pad to 1k */
222 BUILD_ASSERT(sizeof(struct btrfs_ioctl_fs_info_args) == 1024);
224 struct btrfs_ioctl_feature_flags {
226 __u64 compat_ro_flags;
227 __u64 incompat_flags;
229 BUILD_ASSERT(sizeof(struct btrfs_ioctl_feature_flags) == 24);
231 /* balance control ioctl modes */
232 #define BTRFS_BALANCE_CTL_PAUSE 1
233 #define BTRFS_BALANCE_CTL_CANCEL 2
234 #define BTRFS_BALANCE_CTL_RESUME 3
237 * this is packed, because it should be exactly the same as its disk
238 * byte order counterpart (struct btrfs_disk_balance_args)
240 struct btrfs_balance_args {
245 * BTRFS_BALANCE_ARGS_USAGE with a single value means '0..N'
246 * BTRFS_BALANCE_ARGS_USAGE_RANGE - range syntax, min..max
267 * BTRFS_BALANCE_ARGS_LIMIT with value 'limit'
268 * BTRFS_BALANCE_ARGS_LIMIT_RANGE - the extend version can use minimum
272 __u64 limit; /* limit number of processed chunks */
281 } __attribute__ ((__packed__));
283 /* report balance progress to userspace */
284 struct btrfs_balance_progress {
285 __u64 expected; /* estimated # of chunks that will be
286 * relocated to fulfil the request */
287 __u64 considered; /* # of chunks we have considered so far */
288 __u64 completed; /* # of chunks relocated so far */
291 #define BTRFS_BALANCE_STATE_RUNNING (1ULL << 0)
292 #define BTRFS_BALANCE_STATE_PAUSE_REQ (1ULL << 1)
293 #define BTRFS_BALANCE_STATE_CANCEL_REQ (1ULL << 2)
295 struct btrfs_ioctl_balance_args {
296 __u64 flags; /* in/out */
297 __u64 state; /* out */
299 struct btrfs_balance_args data; /* in/out */
300 struct btrfs_balance_args meta; /* in/out */
301 struct btrfs_balance_args sys; /* in/out */
303 struct btrfs_balance_progress stat; /* out */
305 __u64 unused[72]; /* pad to 1k */
307 BUILD_ASSERT(sizeof(struct btrfs_ioctl_balance_args) == 1024);
309 #define BTRFS_INO_LOOKUP_PATH_MAX 4080
310 struct btrfs_ioctl_ino_lookup_args {
313 char name[BTRFS_INO_LOOKUP_PATH_MAX];
315 BUILD_ASSERT(sizeof(struct btrfs_ioctl_ino_lookup_args) == 4096);
317 struct btrfs_ioctl_search_key {
318 /* which root are we searching. 0 is the tree of tree roots */
321 /* keys returned will be >= min and <= max */
325 /* keys returned will be >= min and <= max */
329 /* max and min transids to search for */
333 /* keys returned will be >= min and <= max */
338 * how many items did userland ask for, and how many are we
343 /* align to 64 bits */
346 /* some extra for later */
353 struct btrfs_ioctl_search_header {
359 } __attribute__((may_alias));
361 #define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key))
363 * the buf is an array of search headers where
364 * each header is followed by the actual item
365 * the type field is expanded to 32 bits for alignment
367 struct btrfs_ioctl_search_args {
368 struct btrfs_ioctl_search_key key;
369 char buf[BTRFS_SEARCH_ARGS_BUFSIZE];
373 * Extended version of TREE_SEARCH ioctl that can return more than 4k of bytes.
374 * The allocated size of the buffer is set in buf_size.
376 struct btrfs_ioctl_search_args_v2 {
377 struct btrfs_ioctl_search_key key; /* in/out - search parameters */
378 __u64 buf_size; /* in - size of buffer
379 * out - on EOVERFLOW: needed size
381 __u64 buf[0]; /* out - found items */
383 BUILD_ASSERT(sizeof(struct btrfs_ioctl_search_args_v2) == 112);
385 /* With a @src_length of zero, the range from @src_offset->EOF is cloned! */
386 struct btrfs_ioctl_clone_range_args {
388 __u64 src_offset, src_length;
391 BUILD_ASSERT(sizeof(struct btrfs_ioctl_clone_range_args) == 32);
393 /* flags for the defrag range ioctl */
394 #define BTRFS_DEFRAG_RANGE_COMPRESS 1
395 #define BTRFS_DEFRAG_RANGE_START_IO 2
397 #define BTRFS_SAME_DATA_DIFFERS 1
398 /* For extent-same ioctl */
399 struct btrfs_ioctl_same_extent_info {
400 __s64 fd; /* in - destination file */
401 __u64 logical_offset; /* in - start of extent in destination */
402 __u64 bytes_deduped; /* out - total # of bytes we were able
403 * to dedupe from this file */
404 /* status of this dedupe operation:
405 * 0 if dedup succeeds
407 * == BTRFS_SAME_DATA_DIFFERS if data differs
409 __s32 status; /* out - see above description */
413 struct btrfs_ioctl_same_args {
414 __u64 logical_offset; /* in - start of extent in source */
415 __u64 length; /* in - length of extent */
416 __u16 dest_count; /* in - total elements in info array */
419 struct btrfs_ioctl_same_extent_info info[0];
421 BUILD_ASSERT(sizeof(struct btrfs_ioctl_same_args) == 24);
423 struct btrfs_ioctl_defrag_range_args {
424 /* start of the defrag operation */
427 /* number of bytes to defrag, use (u64)-1 to say all */
431 * flags for the operation, which can include turning
432 * on compression for this one defrag
437 * any extent bigger than this will be considered
438 * already defragged. Use 0 to take the kernel default
439 * Use 1 to say every single extent must be rewritten
444 * which compression method to use if turning on compression
445 * for this defrag operation. If unspecified, zlib will
450 /* spare for later */
453 BUILD_ASSERT(sizeof(struct btrfs_ioctl_defrag_range_args) == 48);
455 struct btrfs_ioctl_space_info {
461 struct btrfs_ioctl_space_args {
464 struct btrfs_ioctl_space_info spaces[0];
466 BUILD_ASSERT(sizeof(struct btrfs_ioctl_space_args) == 16);
468 struct btrfs_data_container {
469 __u32 bytes_left; /* out -- bytes not needed to deliver output */
470 __u32 bytes_missing; /* out -- additional bytes needed for result */
471 __u32 elem_cnt; /* out */
472 __u32 elem_missed; /* out */
473 __u64 val[0]; /* out */
476 struct btrfs_ioctl_ino_path_args {
480 /* struct btrfs_data_container *fspath; out */
481 __u64 fspath; /* out */
483 BUILD_ASSERT(sizeof(struct btrfs_ioctl_ino_path_args) == 56);
485 struct btrfs_ioctl_logical_ino_args {
486 __u64 logical; /* in */
489 /* struct btrfs_data_container *inodes; out */
493 enum btrfs_dev_stat_values {
494 /* disk I/O failure stats */
495 BTRFS_DEV_STAT_WRITE_ERRS, /* EIO or EREMOTEIO from lower layers */
496 BTRFS_DEV_STAT_READ_ERRS, /* EIO or EREMOTEIO from lower layers */
497 BTRFS_DEV_STAT_FLUSH_ERRS, /* EIO or EREMOTEIO from lower layers */
499 /* stats for indirect indications for I/O failures */
500 BTRFS_DEV_STAT_CORRUPTION_ERRS, /* checksum error, bytenr error or
501 * contents is illegal: this is an
502 * indication that the block was damaged
503 * during read or write, or written to
504 * wrong location or read from wrong
506 BTRFS_DEV_STAT_GENERATION_ERRS, /* an indication that blocks have not
509 BTRFS_DEV_STAT_VALUES_MAX
512 /* Reset statistics after reading; needs SYS_ADMIN capability */
513 #define BTRFS_DEV_STATS_RESET (1ULL << 0)
515 struct btrfs_ioctl_get_dev_stats {
516 __u64 devid; /* in */
517 __u64 nr_items; /* in/out */
518 __u64 flags; /* in/out */
521 __u64 values[BTRFS_DEV_STAT_VALUES_MAX];
523 __u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX]; /* pad to 1k + 8B */
525 BUILD_ASSERT(sizeof(struct btrfs_ioctl_get_dev_stats) == 1032);
527 /* BTRFS_IOC_SNAP_CREATE is no longer used by the btrfs command */
528 #define BTRFS_QUOTA_CTL_ENABLE 1
529 #define BTRFS_QUOTA_CTL_DISABLE 2
530 /* 3 has formerly been reserved for BTRFS_QUOTA_CTL_RESCAN */
531 struct btrfs_ioctl_quota_ctl_args {
535 BUILD_ASSERT(sizeof(struct btrfs_ioctl_quota_ctl_args) == 16);
537 struct btrfs_ioctl_quota_rescan_args {
542 BUILD_ASSERT(sizeof(struct btrfs_ioctl_quota_rescan_args) == 64);
544 struct btrfs_ioctl_qgroup_assign_args {
550 struct btrfs_ioctl_qgroup_create_args {
554 BUILD_ASSERT(sizeof(struct btrfs_ioctl_qgroup_create_args) == 16);
556 struct btrfs_ioctl_timespec {
561 struct btrfs_ioctl_received_subvol_args {
562 char uuid[BTRFS_UUID_SIZE]; /* in */
563 __u64 stransid; /* in */
564 __u64 rtransid; /* out */
565 struct btrfs_ioctl_timespec stime; /* in */
566 struct btrfs_ioctl_timespec rtime; /* out */
567 __u64 flags; /* in */
568 __u64 reserved[16]; /* in */
570 BUILD_ASSERT(sizeof(struct btrfs_ioctl_received_subvol_args) == 200);
573 * Caller doesn't want file data in the send stream, even if the
574 * search of clone sources doesn't find an extent. UPDATE_EXTENT
575 * commands will be sent instead of WRITE commands.
577 #define BTRFS_SEND_FLAG_NO_FILE_DATA 0x1
580 * Do not add the leading stream header. Used when multiple snapshots
581 * are sent back to back.
583 #define BTRFS_SEND_FLAG_OMIT_STREAM_HEADER 0x2
586 * Omit the command at the end of the stream that indicated the end
587 * of the stream. This option is used when multiple snapshots are
590 #define BTRFS_SEND_FLAG_OMIT_END_CMD 0x4
592 #define BTRFS_SEND_FLAG_MASK \
593 (BTRFS_SEND_FLAG_NO_FILE_DATA | \
594 BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | \
595 BTRFS_SEND_FLAG_OMIT_END_CMD)
597 struct btrfs_ioctl_send_args {
598 __s64 send_fd; /* in */
599 __u64 clone_sources_count; /* in */
600 __u64 __user *clone_sources; /* in */
601 __u64 parent_root; /* in */
602 __u64 flags; /* in */
603 __u64 reserved[4]; /* in */
606 * Size of structure depends on pointer width, was not caught. Kernel handles
607 * pointer width differences transparently
609 BUILD_ASSERT(sizeof(__u64 *) == 8
610 ? sizeof(struct btrfs_ioctl_send_args) == 72
611 : (sizeof(void *) == 4
612 ? sizeof(struct btrfs_ioctl_send_args) == 68
615 /* Error codes as returned by the kernel */
616 enum btrfs_err_code {
618 BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET,
619 BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET,
620 BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET,
621 BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET,
622 BTRFS_ERROR_DEV_TGT_REPLACE,
623 BTRFS_ERROR_DEV_MISSING_NOT_FOUND,
624 BTRFS_ERROR_DEV_ONLY_WRITABLE,
625 BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS
628 /* An error code to error string mapping for the kernel
631 static inline char *btrfs_err_str(enum btrfs_err_code err_code)
634 case BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET:
635 return "unable to go below two devices on raid1";
636 case BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET:
637 return "unable to go below four devices on raid10";
638 case BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET:
639 return "unable to go below two devices on raid5";
640 case BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET:
641 return "unable to go below three devices on raid6";
642 case BTRFS_ERROR_DEV_TGT_REPLACE:
643 return "unable to remove the dev_replace target dev";
644 case BTRFS_ERROR_DEV_MISSING_NOT_FOUND:
645 return "no missing devices found to remove";
646 case BTRFS_ERROR_DEV_ONLY_WRITABLE:
647 return "unable to remove the only writeable device";
648 case BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS:
649 return "add/delete/balance/replace/resize operation "
656 #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
657 struct btrfs_ioctl_vol_args)
658 #define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
659 struct btrfs_ioctl_vol_args)
660 #define BTRFS_IOC_RESIZE _IOW(BTRFS_IOCTL_MAGIC, 3, \
661 struct btrfs_ioctl_vol_args)
662 #define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, \
663 struct btrfs_ioctl_vol_args)
664 /* trans start and trans end are dangerous, and only for
665 * use by applications that know how to avoid the
666 * resulting deadlocks
668 #define BTRFS_IOC_TRANS_START _IO(BTRFS_IOCTL_MAGIC, 6)
669 #define BTRFS_IOC_TRANS_END _IO(BTRFS_IOCTL_MAGIC, 7)
670 #define BTRFS_IOC_SYNC _IO(BTRFS_IOCTL_MAGIC, 8)
672 #define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int)
673 #define BTRFS_IOC_ADD_DEV _IOW(BTRFS_IOCTL_MAGIC, 10, \
674 struct btrfs_ioctl_vol_args)
675 #define BTRFS_IOC_RM_DEV _IOW(BTRFS_IOCTL_MAGIC, 11, \
676 struct btrfs_ioctl_vol_args)
677 #define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \
678 struct btrfs_ioctl_vol_args)
680 #define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \
681 struct btrfs_ioctl_clone_range_args)
683 #define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, \
684 struct btrfs_ioctl_vol_args)
685 #define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \
686 struct btrfs_ioctl_vol_args)
687 #define BTRFS_IOC_DEFRAG_RANGE _IOW(BTRFS_IOCTL_MAGIC, 16, \
688 struct btrfs_ioctl_defrag_range_args)
689 #define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \
690 struct btrfs_ioctl_search_args)
691 #define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \
692 struct btrfs_ioctl_search_args_v2)
693 #define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \
694 struct btrfs_ioctl_ino_lookup_args)
695 #define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64)
696 #define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, \
697 struct btrfs_ioctl_space_args)
698 #define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64)
699 #define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64)
700 #define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \
701 struct btrfs_ioctl_vol_args_v2)
702 #define BTRFS_IOC_SUBVOL_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 24, \
703 struct btrfs_ioctl_vol_args_v2)
704 #define BTRFS_IOC_SUBVOL_GETFLAGS _IOR(BTRFS_IOCTL_MAGIC, 25, __u64)
705 #define BTRFS_IOC_SUBVOL_SETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 26, __u64)
706 #define BTRFS_IOC_SCRUB _IOWR(BTRFS_IOCTL_MAGIC, 27, \
707 struct btrfs_ioctl_scrub_args)
708 #define BTRFS_IOC_SCRUB_CANCEL _IO(BTRFS_IOCTL_MAGIC, 28)
709 #define BTRFS_IOC_SCRUB_PROGRESS _IOWR(BTRFS_IOCTL_MAGIC, 29, \
710 struct btrfs_ioctl_scrub_args)
711 #define BTRFS_IOC_DEV_INFO _IOWR(BTRFS_IOCTL_MAGIC, 30, \
712 struct btrfs_ioctl_dev_info_args)
713 #define BTRFS_IOC_FS_INFO _IOR(BTRFS_IOCTL_MAGIC, 31, \
714 struct btrfs_ioctl_fs_info_args)
715 #define BTRFS_IOC_BALANCE_V2 _IOWR(BTRFS_IOCTL_MAGIC, 32, \
716 struct btrfs_ioctl_balance_args)
717 #define BTRFS_IOC_BALANCE_CTL _IOW(BTRFS_IOCTL_MAGIC, 33, int)
718 #define BTRFS_IOC_BALANCE_PROGRESS _IOR(BTRFS_IOCTL_MAGIC, 34, \
719 struct btrfs_ioctl_balance_args)
720 #define BTRFS_IOC_INO_PATHS _IOWR(BTRFS_IOCTL_MAGIC, 35, \
721 struct btrfs_ioctl_ino_path_args)
722 #define BTRFS_IOC_LOGICAL_INO _IOWR(BTRFS_IOCTL_MAGIC, 36, \
723 struct btrfs_ioctl_logical_ino_args)
724 #define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, \
725 struct btrfs_ioctl_received_subvol_args)
726 #define BTRFS_IOC_SEND _IOW(BTRFS_IOCTL_MAGIC, 38, struct btrfs_ioctl_send_args)
727 #define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, \
728 struct btrfs_ioctl_vol_args)
729 #define BTRFS_IOC_QUOTA_CTL _IOWR(BTRFS_IOCTL_MAGIC, 40, \
730 struct btrfs_ioctl_quota_ctl_args)
731 #define BTRFS_IOC_QGROUP_ASSIGN _IOW(BTRFS_IOCTL_MAGIC, 41, \
732 struct btrfs_ioctl_qgroup_assign_args)
733 #define BTRFS_IOC_QGROUP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 42, \
734 struct btrfs_ioctl_qgroup_create_args)
735 #define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, \
736 struct btrfs_ioctl_qgroup_limit_args)
737 #define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \
738 struct btrfs_ioctl_quota_rescan_args)
739 #define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \
740 struct btrfs_ioctl_quota_rescan_args)
741 #define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46)
742 #define BTRFS_IOC_GET_FSLABEL _IOR(BTRFS_IOCTL_MAGIC, 49, \
743 char[BTRFS_LABEL_SIZE])
744 #define BTRFS_IOC_SET_FSLABEL _IOW(BTRFS_IOCTL_MAGIC, 50, \
745 char[BTRFS_LABEL_SIZE])
746 #define BTRFS_IOC_GET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 52, \
747 struct btrfs_ioctl_get_dev_stats)
748 #define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \
749 struct btrfs_ioctl_dev_replace_args)
750 #define BTRFS_IOC_FILE_EXTENT_SAME _IOWR(BTRFS_IOCTL_MAGIC, 54, \
751 struct btrfs_ioctl_same_args)
752 #define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
753 struct btrfs_ioctl_feature_flags)
754 #define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \
755 struct btrfs_ioctl_feature_flags[2])
756 #define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
757 struct btrfs_ioctl_feature_flags[3])
758 #define BTRFS_IOC_RM_DEV_V2 _IOW(BTRFS_IOCTL_MAGIC, 58, \
759 struct btrfs_ioctl_vol_args_v2)