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 _UAPI_LINUX_BTRFS_H
20 #define _UAPI_LINUX_BTRFS_H
21 #include <linux/types.h>
22 #include <linux/ioctl.h>
24 #define BTRFS_IOCTL_MAGIC 0x94
25 #define BTRFS_VOL_NAME_MAX 255
26 #define BTRFS_LABEL_SIZE 256
28 /* this should be 4k */
29 #define BTRFS_PATH_NAME_MAX 4087
30 struct btrfs_ioctl_vol_args {
32 char name[BTRFS_PATH_NAME_MAX + 1];
35 #define BTRFS_DEVICE_PATH_NAME_MAX 1024
37 #define BTRFS_FSID_SIZE 16
38 #define BTRFS_UUID_SIZE 16
39 #define BTRFS_UUID_UNPARSED_SIZE 37
42 * flags definition for qgroup limits
45 * struct btrfs_qgroup_limit.flags
46 * struct btrfs_qgroup_limit_item.flags
48 #define BTRFS_QGROUP_LIMIT_MAX_RFER (1ULL << 0)
49 #define BTRFS_QGROUP_LIMIT_MAX_EXCL (1ULL << 1)
50 #define BTRFS_QGROUP_LIMIT_RSV_RFER (1ULL << 2)
51 #define BTRFS_QGROUP_LIMIT_RSV_EXCL (1ULL << 3)
52 #define BTRFS_QGROUP_LIMIT_RFER_CMPR (1ULL << 4)
53 #define BTRFS_QGROUP_LIMIT_EXCL_CMPR (1ULL << 5)
55 struct btrfs_qgroup_limit {
64 * flags definition for qgroup inheritance
67 * struct btrfs_qgroup_inherit.flags
69 #define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0)
71 struct btrfs_qgroup_inherit {
75 __u64 num_excl_copies;
76 struct btrfs_qgroup_limit lim;
80 struct btrfs_ioctl_qgroup_limit_args {
82 struct btrfs_qgroup_limit lim;
86 * flags for subvolumes
89 * struct btrfs_ioctl_vol_args_v2.flags
91 * BTRFS_SUBVOL_RDONLY is also provided/consumed by the following ioctls:
92 * - BTRFS_IOC_SUBVOL_GETFLAGS
93 * - BTRFS_IOC_SUBVOL_SETFLAGS
95 #define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0)
96 #define BTRFS_SUBVOL_RDONLY (1ULL << 1)
97 #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2)
99 #define BTRFS_SUBVOL_NAME_MAX 4039
100 struct btrfs_ioctl_vol_args_v2 {
107 struct btrfs_qgroup_inherit __user *qgroup_inherit;
111 char name[BTRFS_SUBVOL_NAME_MAX + 1];
115 * structure to report errors and progress to userspace, either as a
116 * result of a finished scrub, a canceled scrub or a progress inquiry
118 struct btrfs_scrub_progress {
119 __u64 data_extents_scrubbed; /* # of data extents scrubbed */
120 __u64 tree_extents_scrubbed; /* # of tree extents scrubbed */
121 __u64 data_bytes_scrubbed; /* # of data bytes scrubbed */
122 __u64 tree_bytes_scrubbed; /* # of tree bytes scrubbed */
123 __u64 read_errors; /* # of read errors encountered (EIO) */
124 __u64 csum_errors; /* # of failed csum checks */
125 __u64 verify_errors; /* # of occurences, where the metadata
126 * of a tree block did not match the
127 * expected values, like generation or
129 __u64 no_csum; /* # of 4k data block for which no csum
130 * is present, probably the result of
131 * data written with nodatasum */
132 __u64 csum_discards; /* # of csum for which no data was found
133 * in the extent tree. */
134 __u64 super_errors; /* # of bad super blocks encountered */
135 __u64 malloc_errors; /* # of internal kmalloc errors. These
136 * will likely cause an incomplete
138 __u64 uncorrectable_errors; /* # of errors where either no intact
139 * copy was found or the writeback
141 __u64 corrected_errors; /* # of errors corrected */
142 __u64 last_physical; /* last physical address scrubbed. In
143 * case a scrub was aborted, this can
144 * be used to restart the scrub */
145 __u64 unverified_errors; /* # of occurences where a read for a
146 * full (64k) bio failed, but the re-
147 * check succeeded for each 4k piece.
148 * Intermittent error. */
151 #define BTRFS_SCRUB_READONLY 1
152 struct btrfs_ioctl_scrub_args {
153 __u64 devid; /* in */
154 __u64 start; /* in */
156 __u64 flags; /* in */
157 struct btrfs_scrub_progress progress; /* out */
159 __u64 unused[(1024-32-sizeof(struct btrfs_scrub_progress))/8];
162 #define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0
163 #define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID 1
164 struct btrfs_ioctl_dev_replace_start_params {
165 __u64 srcdevid; /* in, if 0, use srcdev_name instead */
166 __u64 cont_reading_from_srcdev_mode; /* in, see #define
168 __u8 srcdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1]; /* in */
169 __u8 tgtdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1]; /* in */
172 #define BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED 0
173 #define BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED 1
174 #define BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED 2
175 #define BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED 3
176 #define BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED 4
177 struct btrfs_ioctl_dev_replace_status_params {
178 __u64 replace_state; /* out, see #define above */
179 __u64 progress_1000; /* out, 0 <= x <= 1000 */
180 __u64 time_started; /* out, seconds since 1-Jan-1970 */
181 __u64 time_stopped; /* out, seconds since 1-Jan-1970 */
182 __u64 num_write_errors; /* out */
183 __u64 num_uncorrectable_read_errors; /* out */
186 #define BTRFS_IOCTL_DEV_REPLACE_CMD_START 0
187 #define BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS 1
188 #define BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL 2
189 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR 0
190 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED 1
191 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED 2
192 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS 3
193 struct btrfs_ioctl_dev_replace_args {
195 __u64 result; /* out */
198 struct btrfs_ioctl_dev_replace_start_params start;
199 struct btrfs_ioctl_dev_replace_status_params status;
205 struct btrfs_ioctl_dev_info_args {
206 __u64 devid; /* in/out */
207 __u8 uuid[BTRFS_UUID_SIZE]; /* in/out */
208 __u64 bytes_used; /* out */
209 __u64 total_bytes; /* out */
210 __u64 unused[379]; /* pad to 4k */
211 __u8 path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */
214 struct btrfs_ioctl_fs_info_args {
215 __u64 max_id; /* out */
216 __u64 num_devices; /* out */
217 __u8 fsid[BTRFS_FSID_SIZE]; /* out */
218 __u32 nodesize; /* out */
219 __u32 sectorsize; /* out */
220 __u32 clone_alignment; /* out */
222 __u64 reserved[122]; /* pad to 1k */
229 * struct btrfs_ioctl_feature_flags
231 #define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE (1ULL << 0)
233 #define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0)
234 #define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1)
235 #define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2)
236 #define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO (1ULL << 3)
238 * some patches floated around with a second compression method
239 * lets save that incompat here for when they do get in
240 * Note we don't actually support it, we're just reserving the
243 #define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZOv2 (1ULL << 4)
246 * older kernels tried to do bigger metadata blocks, but the
247 * code was pretty buggy. Lets not let them try anymore.
249 #define BTRFS_FEATURE_INCOMPAT_BIG_METADATA (1ULL << 5)
251 #define BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF (1ULL << 6)
252 #define BTRFS_FEATURE_INCOMPAT_RAID56 (1ULL << 7)
253 #define BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA (1ULL << 8)
254 #define BTRFS_FEATURE_INCOMPAT_NO_HOLES (1ULL << 9)
256 struct btrfs_ioctl_feature_flags {
258 __u64 compat_ro_flags;
259 __u64 incompat_flags;
262 /* balance control ioctl modes */
263 #define BTRFS_BALANCE_CTL_PAUSE 1
264 #define BTRFS_BALANCE_CTL_CANCEL 2
267 * this is packed, because it should be exactly the same as its disk
268 * byte order counterpart (struct btrfs_disk_balance_args)
270 struct btrfs_balance_args {
290 * BTRFS_BALANCE_ARGS_LIMIT with value 'limit'
291 * BTRFS_BALANCE_ARGS_LIMIT_RANGE - the extend version can use minimum
295 __u64 limit; /* limit number of processed chunks */
303 * Process chunks that cross stripes_min..stripes_max devices,
304 * BTRFS_BALANCE_ARGS_STRIPES_RANGE
310 } __attribute__ ((__packed__));
312 /* report balance progress to userspace */
313 struct btrfs_balance_progress {
314 __u64 expected; /* estimated # of chunks that will be
315 * relocated to fulfill the request */
316 __u64 considered; /* # of chunks we have considered so far */
317 __u64 completed; /* # of chunks relocated so far */
321 * flags definition for balance
323 * Restriper's general type filter
326 * btrfs_ioctl_balance_args.flags
327 * btrfs_balance_control.flags (internal)
329 #define BTRFS_BALANCE_DATA (1ULL << 0)
330 #define BTRFS_BALANCE_SYSTEM (1ULL << 1)
331 #define BTRFS_BALANCE_METADATA (1ULL << 2)
333 #define BTRFS_BALANCE_TYPE_MASK (BTRFS_BALANCE_DATA | \
334 BTRFS_BALANCE_SYSTEM | \
335 BTRFS_BALANCE_METADATA)
337 #define BTRFS_BALANCE_FORCE (1ULL << 3)
338 #define BTRFS_BALANCE_RESUME (1ULL << 4)
341 * flags definitions for per-type balance args
346 * struct btrfs_balance_args
348 #define BTRFS_BALANCE_ARGS_PROFILES (1ULL << 0)
349 #define BTRFS_BALANCE_ARGS_USAGE (1ULL << 1)
350 #define BTRFS_BALANCE_ARGS_DEVID (1ULL << 2)
351 #define BTRFS_BALANCE_ARGS_DRANGE (1ULL << 3)
352 #define BTRFS_BALANCE_ARGS_VRANGE (1ULL << 4)
353 #define BTRFS_BALANCE_ARGS_LIMIT (1ULL << 5)
354 #define BTRFS_BALANCE_ARGS_LIMIT_RANGE (1ULL << 6)
355 #define BTRFS_BALANCE_ARGS_STRIPES_RANGE (1ULL << 7)
356 #define BTRFS_BALANCE_ARGS_USAGE_RANGE (1ULL << 10)
358 #define BTRFS_BALANCE_ARGS_MASK \
359 (BTRFS_BALANCE_ARGS_PROFILES | \
360 BTRFS_BALANCE_ARGS_USAGE | \
361 BTRFS_BALANCE_ARGS_DEVID | \
362 BTRFS_BALANCE_ARGS_DRANGE | \
363 BTRFS_BALANCE_ARGS_VRANGE | \
364 BTRFS_BALANCE_ARGS_LIMIT | \
365 BTRFS_BALANCE_ARGS_LIMIT_RANGE | \
366 BTRFS_BALANCE_ARGS_STRIPES_RANGE | \
367 BTRFS_BALANCE_ARGS_USAGE_RANGE)
370 * Profile changing flags. When SOFT is set we won't relocate chunk if
371 * it already has the target profile (even though it may be
374 #define BTRFS_BALANCE_ARGS_CONVERT (1ULL << 8)
375 #define BTRFS_BALANCE_ARGS_SOFT (1ULL << 9)
379 * flags definition for balance state
382 * struct btrfs_ioctl_balance_args.state
384 #define BTRFS_BALANCE_STATE_RUNNING (1ULL << 0)
385 #define BTRFS_BALANCE_STATE_PAUSE_REQ (1ULL << 1)
386 #define BTRFS_BALANCE_STATE_CANCEL_REQ (1ULL << 2)
388 struct btrfs_ioctl_balance_args {
389 __u64 flags; /* in/out */
390 __u64 state; /* out */
392 struct btrfs_balance_args data; /* in/out */
393 struct btrfs_balance_args meta; /* in/out */
394 struct btrfs_balance_args sys; /* in/out */
396 struct btrfs_balance_progress stat; /* out */
398 __u64 unused[72]; /* pad to 1k */
401 #define BTRFS_INO_LOOKUP_PATH_MAX 4080
402 struct btrfs_ioctl_ino_lookup_args {
405 char name[BTRFS_INO_LOOKUP_PATH_MAX];
408 struct btrfs_ioctl_search_key {
409 /* which root are we searching. 0 is the tree of tree roots */
412 /* keys returned will be >= min and <= max */
416 /* keys returned will be >= min and <= max */
420 /* max and min transids to search for */
424 /* keys returned will be >= min and <= max */
429 * how many items did userland ask for, and how many are we
434 /* align to 64 bits */
437 /* some extra for later */
444 struct btrfs_ioctl_search_header {
452 #define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key))
454 * the buf is an array of search headers where
455 * each header is followed by the actual item
456 * the type field is expanded to 32 bits for alignment
458 struct btrfs_ioctl_search_args {
459 struct btrfs_ioctl_search_key key;
460 char buf[BTRFS_SEARCH_ARGS_BUFSIZE];
463 struct btrfs_ioctl_search_args_v2 {
464 struct btrfs_ioctl_search_key key; /* in/out - search parameters */
465 __u64 buf_size; /* in - size of buffer
466 * out - on EOVERFLOW: needed size
468 __u64 buf[0]; /* out - found items */
471 struct btrfs_ioctl_clone_range_args {
473 __u64 src_offset, src_length;
478 * flags definition for the defrag range ioctl
481 * struct btrfs_ioctl_defrag_range_args.flags
483 #define BTRFS_DEFRAG_RANGE_COMPRESS 1
484 #define BTRFS_DEFRAG_RANGE_START_IO 2
485 struct btrfs_ioctl_defrag_range_args {
486 /* start of the defrag operation */
489 /* number of bytes to defrag, use (u64)-1 to say all */
493 * flags for the operation, which can include turning
494 * on compression for this one defrag
499 * any extent bigger than this will be considered
500 * already defragged. Use 0 to take the kernel default
501 * Use 1 to say every single extent must be rewritten
506 * which compression method to use if turning on compression
507 * for this defrag operation. If unspecified, zlib will
512 /* spare for later */
517 #define BTRFS_SAME_DATA_DIFFERS 1
518 /* For extent-same ioctl */
519 struct btrfs_ioctl_same_extent_info {
520 __s64 fd; /* in - destination file */
521 __u64 logical_offset; /* in - start of extent in destination */
522 __u64 bytes_deduped; /* out - total # of bytes we were able
523 * to dedupe from this file */
524 /* status of this dedupe operation:
525 * 0 if dedup succeeds
527 * == BTRFS_SAME_DATA_DIFFERS if data differs
529 __s32 status; /* out - see above description */
533 struct btrfs_ioctl_same_args {
534 __u64 logical_offset; /* in - start of extent in source */
535 __u64 length; /* in - length of extent */
536 __u16 dest_count; /* in - total elements in info array */
539 struct btrfs_ioctl_same_extent_info info[0];
542 struct btrfs_ioctl_space_info {
548 struct btrfs_ioctl_space_args {
551 struct btrfs_ioctl_space_info spaces[0];
554 struct btrfs_data_container {
555 __u32 bytes_left; /* out -- bytes not needed to deliver output */
556 __u32 bytes_missing; /* out -- additional bytes needed for result */
557 __u32 elem_cnt; /* out */
558 __u32 elem_missed; /* out */
559 __u64 val[0]; /* out */
562 struct btrfs_ioctl_ino_path_args {
566 /* struct btrfs_data_container *fspath; out */
567 __u64 fspath; /* out */
570 struct btrfs_ioctl_logical_ino_args {
571 __u64 logical; /* in */
574 /* struct btrfs_data_container *inodes; out */
578 enum btrfs_dev_stat_values {
579 /* disk I/O failure stats */
580 BTRFS_DEV_STAT_WRITE_ERRS, /* EIO or EREMOTEIO from lower layers */
581 BTRFS_DEV_STAT_READ_ERRS, /* EIO or EREMOTEIO from lower layers */
582 BTRFS_DEV_STAT_FLUSH_ERRS, /* EIO or EREMOTEIO from lower layers */
584 /* stats for indirect indications for I/O failures */
585 BTRFS_DEV_STAT_CORRUPTION_ERRS, /* checksum error, bytenr error or
586 * contents is illegal: this is an
587 * indication that the block was damaged
588 * during read or write, or written to
589 * wrong location or read from wrong
591 BTRFS_DEV_STAT_GENERATION_ERRS, /* an indication that blocks have not
594 BTRFS_DEV_STAT_VALUES_MAX
597 /* Reset statistics after reading; needs SYS_ADMIN capability */
598 #define BTRFS_DEV_STATS_RESET (1ULL << 0)
600 struct btrfs_ioctl_get_dev_stats {
601 __u64 devid; /* in */
602 __u64 nr_items; /* in/out */
603 __u64 flags; /* in/out */
606 __u64 values[BTRFS_DEV_STAT_VALUES_MAX];
608 __u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX]; /* pad to 1k */
611 #define BTRFS_QUOTA_CTL_ENABLE 1
612 #define BTRFS_QUOTA_CTL_DISABLE 2
613 #define BTRFS_QUOTA_CTL_RESCAN__NOTUSED 3
614 struct btrfs_ioctl_quota_ctl_args {
619 struct btrfs_ioctl_quota_rescan_args {
625 struct btrfs_ioctl_qgroup_assign_args {
631 struct btrfs_ioctl_qgroup_create_args {
635 struct btrfs_ioctl_timespec {
640 struct btrfs_ioctl_received_subvol_args {
641 char uuid[BTRFS_UUID_SIZE]; /* in */
642 __u64 stransid; /* in */
643 __u64 rtransid; /* out */
644 struct btrfs_ioctl_timespec stime; /* in */
645 struct btrfs_ioctl_timespec rtime; /* out */
646 __u64 flags; /* in */
647 __u64 reserved[16]; /* in */
651 * Caller doesn't want file data in the send stream, even if the
652 * search of clone sources doesn't find an extent. UPDATE_EXTENT
653 * commands will be sent instead of WRITE commands.
655 #define BTRFS_SEND_FLAG_NO_FILE_DATA 0x1
658 * Do not add the leading stream header. Used when multiple snapshots
659 * are sent back to back.
661 #define BTRFS_SEND_FLAG_OMIT_STREAM_HEADER 0x2
664 * Omit the command at the end of the stream that indicated the end
665 * of the stream. This option is used when multiple snapshots are
668 #define BTRFS_SEND_FLAG_OMIT_END_CMD 0x4
670 #define BTRFS_SEND_FLAG_MASK \
671 (BTRFS_SEND_FLAG_NO_FILE_DATA | \
672 BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | \
673 BTRFS_SEND_FLAG_OMIT_END_CMD)
675 struct btrfs_ioctl_send_args {
676 __s64 send_fd; /* in */
677 __u64 clone_sources_count; /* in */
678 __u64 __user *clone_sources; /* in */
679 __u64 parent_root; /* in */
680 __u64 flags; /* in */
681 __u64 reserved[4]; /* in */
684 /* Error codes as returned by the kernel */
685 enum btrfs_err_code {
686 BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET = 1,
687 BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET,
688 BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET,
689 BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET,
690 BTRFS_ERROR_DEV_TGT_REPLACE,
691 BTRFS_ERROR_DEV_MISSING_NOT_FOUND,
692 BTRFS_ERROR_DEV_ONLY_WRITABLE,
693 BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS
695 /* An error code to error string mapping for the kernel
698 static inline char *btrfs_err_str(enum btrfs_err_code err_code)
701 case BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET:
702 return "unable to go below two devices on raid1";
703 case BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET:
704 return "unable to go below four devices on raid10";
705 case BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET:
706 return "unable to go below two devices on raid5";
707 case BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET:
708 return "unable to go below three devices on raid6";
709 case BTRFS_ERROR_DEV_TGT_REPLACE:
710 return "unable to remove the dev_replace target dev";
711 case BTRFS_ERROR_DEV_MISSING_NOT_FOUND:
712 return "no missing devices found to remove";
713 case BTRFS_ERROR_DEV_ONLY_WRITABLE:
714 return "unable to remove the only writeable device";
715 case BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS:
716 return "add/delete/balance/replace/resize operation "\
723 #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
724 struct btrfs_ioctl_vol_args)
725 #define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
726 struct btrfs_ioctl_vol_args)
727 #define BTRFS_IOC_RESIZE _IOW(BTRFS_IOCTL_MAGIC, 3, \
728 struct btrfs_ioctl_vol_args)
729 #define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, \
730 struct btrfs_ioctl_vol_args)
731 /* trans start and trans end are dangerous, and only for
732 * use by applications that know how to avoid the
733 * resulting deadlocks
735 #define BTRFS_IOC_TRANS_START _IO(BTRFS_IOCTL_MAGIC, 6)
736 #define BTRFS_IOC_TRANS_END _IO(BTRFS_IOCTL_MAGIC, 7)
737 #define BTRFS_IOC_SYNC _IO(BTRFS_IOCTL_MAGIC, 8)
739 #define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int)
740 #define BTRFS_IOC_ADD_DEV _IOW(BTRFS_IOCTL_MAGIC, 10, \
741 struct btrfs_ioctl_vol_args)
742 #define BTRFS_IOC_RM_DEV _IOW(BTRFS_IOCTL_MAGIC, 11, \
743 struct btrfs_ioctl_vol_args)
744 #define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \
745 struct btrfs_ioctl_vol_args)
747 #define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \
748 struct btrfs_ioctl_clone_range_args)
750 #define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, \
751 struct btrfs_ioctl_vol_args)
752 #define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \
753 struct btrfs_ioctl_vol_args)
754 #define BTRFS_IOC_DEFRAG_RANGE _IOW(BTRFS_IOCTL_MAGIC, 16, \
755 struct btrfs_ioctl_defrag_range_args)
756 #define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \
757 struct btrfs_ioctl_search_args)
758 #define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \
759 struct btrfs_ioctl_search_args_v2)
760 #define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \
761 struct btrfs_ioctl_ino_lookup_args)
762 #define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64)
763 #define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, \
764 struct btrfs_ioctl_space_args)
765 #define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64)
766 #define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64)
767 #define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \
768 struct btrfs_ioctl_vol_args_v2)
769 #define BTRFS_IOC_SUBVOL_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 24, \
770 struct btrfs_ioctl_vol_args_v2)
771 #define BTRFS_IOC_SUBVOL_GETFLAGS _IOR(BTRFS_IOCTL_MAGIC, 25, __u64)
772 #define BTRFS_IOC_SUBVOL_SETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 26, __u64)
773 #define BTRFS_IOC_SCRUB _IOWR(BTRFS_IOCTL_MAGIC, 27, \
774 struct btrfs_ioctl_scrub_args)
775 #define BTRFS_IOC_SCRUB_CANCEL _IO(BTRFS_IOCTL_MAGIC, 28)
776 #define BTRFS_IOC_SCRUB_PROGRESS _IOWR(BTRFS_IOCTL_MAGIC, 29, \
777 struct btrfs_ioctl_scrub_args)
778 #define BTRFS_IOC_DEV_INFO _IOWR(BTRFS_IOCTL_MAGIC, 30, \
779 struct btrfs_ioctl_dev_info_args)
780 #define BTRFS_IOC_FS_INFO _IOR(BTRFS_IOCTL_MAGIC, 31, \
781 struct btrfs_ioctl_fs_info_args)
782 #define BTRFS_IOC_BALANCE_V2 _IOWR(BTRFS_IOCTL_MAGIC, 32, \
783 struct btrfs_ioctl_balance_args)
784 #define BTRFS_IOC_BALANCE_CTL _IOW(BTRFS_IOCTL_MAGIC, 33, int)
785 #define BTRFS_IOC_BALANCE_PROGRESS _IOR(BTRFS_IOCTL_MAGIC, 34, \
786 struct btrfs_ioctl_balance_args)
787 #define BTRFS_IOC_INO_PATHS _IOWR(BTRFS_IOCTL_MAGIC, 35, \
788 struct btrfs_ioctl_ino_path_args)
789 #define BTRFS_IOC_LOGICAL_INO _IOWR(BTRFS_IOCTL_MAGIC, 36, \
790 struct btrfs_ioctl_ino_path_args)
791 #define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, \
792 struct btrfs_ioctl_received_subvol_args)
793 #define BTRFS_IOC_SEND _IOW(BTRFS_IOCTL_MAGIC, 38, struct btrfs_ioctl_send_args)
794 #define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, \
795 struct btrfs_ioctl_vol_args)
796 #define BTRFS_IOC_QUOTA_CTL _IOWR(BTRFS_IOCTL_MAGIC, 40, \
797 struct btrfs_ioctl_quota_ctl_args)
798 #define BTRFS_IOC_QGROUP_ASSIGN _IOW(BTRFS_IOCTL_MAGIC, 41, \
799 struct btrfs_ioctl_qgroup_assign_args)
800 #define BTRFS_IOC_QGROUP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 42, \
801 struct btrfs_ioctl_qgroup_create_args)
802 #define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, \
803 struct btrfs_ioctl_qgroup_limit_args)
804 #define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \
805 struct btrfs_ioctl_quota_rescan_args)
806 #define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \
807 struct btrfs_ioctl_quota_rescan_args)
808 #define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46)
809 #define BTRFS_IOC_GET_FSLABEL _IOR(BTRFS_IOCTL_MAGIC, 49, \
810 char[BTRFS_LABEL_SIZE])
811 #define BTRFS_IOC_SET_FSLABEL _IOW(BTRFS_IOCTL_MAGIC, 50, \
812 char[BTRFS_LABEL_SIZE])
813 #define BTRFS_IOC_GET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 52, \
814 struct btrfs_ioctl_get_dev_stats)
815 #define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \
816 struct btrfs_ioctl_dev_replace_args)
817 #define BTRFS_IOC_FILE_EXTENT_SAME _IOWR(BTRFS_IOCTL_MAGIC, 54, \
818 struct btrfs_ioctl_same_args)
819 #define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
820 struct btrfs_ioctl_feature_flags)
821 #define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \
822 struct btrfs_ioctl_feature_flags[2])
823 #define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
824 struct btrfs_ioctl_feature_flags[3])
826 #endif /* _UAPI_LINUX_BTRFS_H */