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>
34 /* We don't want to include entire kerncompat.h */
36 #define BUILD_ASSERT(x)
39 #define BTRFS_IOCTL_MAGIC 0x94
40 #define BTRFS_VOL_NAME_MAX 255
42 /* this should be 4k */
43 #define BTRFS_PATH_NAME_MAX 4087
44 struct btrfs_ioctl_vol_args {
46 char name[BTRFS_PATH_NAME_MAX + 1];
48 BUILD_ASSERT(sizeof(struct btrfs_ioctl_vol_args) == 4096);
50 #define BTRFS_DEVICE_PATH_NAME_MAX 1024
52 #define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0)
53 #define BTRFS_SUBVOL_RDONLY (1ULL << 1)
54 #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2)
55 #define BTRFS_DEVICE_SPEC_BY_ID (1ULL << 3)
57 #define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED \
58 (BTRFS_SUBVOL_CREATE_ASYNC | \
59 BTRFS_SUBVOL_RDONLY | \
60 BTRFS_SUBVOL_QGROUP_INHERIT | \
61 BTRFS_DEVICE_SPEC_BY_ID)
63 #define BTRFS_FSID_SIZE 16
64 #define BTRFS_UUID_SIZE 16
66 #define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0)
68 struct btrfs_qgroup_limit {
75 BUILD_ASSERT(sizeof(struct btrfs_qgroup_limit) == 40);
77 struct btrfs_qgroup_inherit {
81 __u64 num_excl_copies;
82 struct btrfs_qgroup_limit lim;
85 BUILD_ASSERT(sizeof(struct btrfs_qgroup_inherit) == 72);
87 struct btrfs_ioctl_qgroup_limit_args {
89 struct btrfs_qgroup_limit lim;
91 BUILD_ASSERT(sizeof(struct btrfs_ioctl_qgroup_limit_args) == 48);
93 #define BTRFS_SUBVOL_NAME_MAX 4039
94 struct btrfs_ioctl_vol_args_v2 {
101 struct btrfs_qgroup_inherit __user *qgroup_inherit;
106 char name[BTRFS_SUBVOL_NAME_MAX + 1];
110 BUILD_ASSERT(sizeof(struct btrfs_ioctl_vol_args_v2) == 4096);
113 * structure to report errors and progress to userspace, either as a
114 * result of a finished scrub, a canceled scrub or a progress inquiry
116 struct btrfs_scrub_progress {
117 __u64 data_extents_scrubbed; /* # of data extents scrubbed */
118 __u64 tree_extents_scrubbed; /* # of tree extents scrubbed */
119 __u64 data_bytes_scrubbed; /* # of data bytes scrubbed */
120 __u64 tree_bytes_scrubbed; /* # of tree bytes scrubbed */
121 __u64 read_errors; /* # of read errors encountered (EIO) */
122 __u64 csum_errors; /* # of failed csum checks */
123 __u64 verify_errors; /* # of occurrences, where the metadata
124 * of a tree block did not match the
125 * expected values, like generation or
127 __u64 no_csum; /* # of 4k data block for which no csum
128 * is present, probably the result of
129 * data written with nodatasum */
130 __u64 csum_discards; /* # of csum for which no data was found
131 * in the extent tree. */
132 __u64 super_errors; /* # of bad super blocks encountered */
133 __u64 malloc_errors; /* # of internal kmalloc errors. These
134 * will likely cause an incomplete
136 __u64 uncorrectable_errors; /* # of errors where either no intact
137 * copy was found or the writeback
139 __u64 corrected_errors; /* # of errors corrected */
140 __u64 last_physical; /* last physical address scrubbed. In
141 * case a scrub was aborted, this can
142 * be used to restart the scrub */
143 __u64 unverified_errors; /* # of occurrences where a read for a
144 * full (64k) bio failed, but the re-
145 * check succeeded for each 4k piece.
146 * Intermittent error. */
149 #define BTRFS_SCRUB_READONLY 1
150 struct btrfs_ioctl_scrub_args {
151 __u64 devid; /* in */
152 __u64 start; /* in */
154 __u64 flags; /* in */
155 struct btrfs_scrub_progress progress; /* out */
157 __u64 unused[(1024-32-sizeof(struct btrfs_scrub_progress))/8];
159 BUILD_ASSERT(sizeof(struct btrfs_ioctl_scrub_args) == 1024);
161 #define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0
162 #define BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID 1
163 struct btrfs_ioctl_dev_replace_start_params {
164 __u64 srcdevid; /* in, if 0, use srcdev_name instead */
165 __u64 cont_reading_from_srcdev_mode; /* in, see #define
167 __u8 srcdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1]; /* in */
168 __u8 tgtdev_name[BTRFS_DEVICE_PATH_NAME_MAX + 1]; /* in */
170 BUILD_ASSERT(sizeof(struct btrfs_ioctl_dev_replace_start_params) == 2072);
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 */
185 BUILD_ASSERT(sizeof(struct btrfs_ioctl_dev_replace_status_params) == 48);
187 #define BTRFS_IOCTL_DEV_REPLACE_CMD_START 0
188 #define BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS 1
189 #define BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL 2
190 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT -1
191 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR 0
192 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED 1
193 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED 2
194 #define BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS 3
195 struct btrfs_ioctl_dev_replace_args {
197 __u64 result; /* out */
200 struct btrfs_ioctl_dev_replace_start_params start;
201 struct btrfs_ioctl_dev_replace_status_params status;
206 BUILD_ASSERT(sizeof(struct btrfs_ioctl_dev_replace_args) == 2600);
208 struct btrfs_ioctl_dev_info_args {
209 __u64 devid; /* in/out */
210 __u8 uuid[BTRFS_UUID_SIZE]; /* in/out */
211 __u64 bytes_used; /* out */
212 __u64 total_bytes; /* out */
213 __u64 unused[379]; /* pad to 4k */
214 __u8 path[BTRFS_DEVICE_PATH_NAME_MAX]; /* out */
216 BUILD_ASSERT(sizeof(struct btrfs_ioctl_dev_info_args) == 4096);
218 struct btrfs_ioctl_fs_info_args {
219 __u64 max_id; /* out */
220 __u64 num_devices; /* out */
221 __u8 fsid[BTRFS_FSID_SIZE]; /* out */
222 __u32 nodesize; /* out */
223 __u32 sectorsize; /* out */
224 __u32 clone_alignment; /* out */
226 __u64 reserved[122]; /* pad to 1k */
228 BUILD_ASSERT(sizeof(struct btrfs_ioctl_fs_info_args) == 1024);
230 struct btrfs_ioctl_feature_flags {
232 __u64 compat_ro_flags;
233 __u64 incompat_flags;
235 BUILD_ASSERT(sizeof(struct btrfs_ioctl_feature_flags) == 24);
237 /* balance control ioctl modes */
238 #define BTRFS_BALANCE_CTL_PAUSE 1
239 #define BTRFS_BALANCE_CTL_CANCEL 2
240 #define BTRFS_BALANCE_CTL_RESUME 3
243 * this is packed, because it should be exactly the same as its disk
244 * byte order counterpart (struct btrfs_disk_balance_args)
246 struct btrfs_balance_args {
251 * BTRFS_BALANCE_ARGS_USAGE with a single value means '0..N'
252 * BTRFS_BALANCE_ARGS_USAGE_RANGE - range syntax, min..max
273 * BTRFS_BALANCE_ARGS_LIMIT with value 'limit'
274 * BTRFS_BALANCE_ARGS_LIMIT_RANGE - the extend version can use minimum
278 __u64 limit; /* limit number of processed chunks */
287 } __attribute__ ((__packed__));
289 /* report balance progress to userspace */
290 struct btrfs_balance_progress {
291 __u64 expected; /* estimated # of chunks that will be
292 * relocated to fulfil the request */
293 __u64 considered; /* # of chunks we have considered so far */
294 __u64 completed; /* # of chunks relocated so far */
297 #define BTRFS_BALANCE_STATE_RUNNING (1ULL << 0)
298 #define BTRFS_BALANCE_STATE_PAUSE_REQ (1ULL << 1)
299 #define BTRFS_BALANCE_STATE_CANCEL_REQ (1ULL << 2)
301 struct btrfs_ioctl_balance_args {
302 __u64 flags; /* in/out */
303 __u64 state; /* out */
305 struct btrfs_balance_args data; /* in/out */
306 struct btrfs_balance_args meta; /* in/out */
307 struct btrfs_balance_args sys; /* in/out */
309 struct btrfs_balance_progress stat; /* out */
311 __u64 unused[72]; /* pad to 1k */
313 BUILD_ASSERT(sizeof(struct btrfs_ioctl_balance_args) == 1024);
315 #define BTRFS_INO_LOOKUP_PATH_MAX 4080
316 struct btrfs_ioctl_ino_lookup_args {
319 char name[BTRFS_INO_LOOKUP_PATH_MAX];
321 BUILD_ASSERT(sizeof(struct btrfs_ioctl_ino_lookup_args) == 4096);
323 struct btrfs_ioctl_search_key {
324 /* which root are we searching. 0 is the tree of tree roots */
327 /* keys returned will be >= min and <= max */
331 /* keys returned will be >= min and <= max */
335 /* max and min transids to search for */
339 /* keys returned will be >= min and <= max */
344 * how many items did userland ask for, and how many are we
349 /* align to 64 bits */
352 /* some extra for later */
359 struct btrfs_ioctl_search_header {
365 } __attribute__((may_alias));
367 #define BTRFS_SEARCH_ARGS_BUFSIZE (4096 - sizeof(struct btrfs_ioctl_search_key))
369 * the buf is an array of search headers where
370 * each header is followed by the actual item
371 * the type field is expanded to 32 bits for alignment
373 struct btrfs_ioctl_search_args {
374 struct btrfs_ioctl_search_key key;
375 char buf[BTRFS_SEARCH_ARGS_BUFSIZE];
379 * Extended version of TREE_SEARCH ioctl that can return more than 4k of bytes.
380 * The allocated size of the buffer is set in buf_size.
382 struct btrfs_ioctl_search_args_v2 {
383 struct btrfs_ioctl_search_key key; /* in/out - search parameters */
384 __u64 buf_size; /* in - size of buffer
385 * out - on EOVERFLOW: needed size
387 __u64 buf[0]; /* out - found items */
389 BUILD_ASSERT(sizeof(struct btrfs_ioctl_search_args_v2) == 112);
391 /* With a @src_length of zero, the range from @src_offset->EOF is cloned! */
392 struct btrfs_ioctl_clone_range_args {
394 __u64 src_offset, src_length;
397 BUILD_ASSERT(sizeof(struct btrfs_ioctl_clone_range_args) == 32);
399 /* flags for the defrag range ioctl */
400 #define BTRFS_DEFRAG_RANGE_COMPRESS 1
401 #define BTRFS_DEFRAG_RANGE_START_IO 2
403 #define BTRFS_SAME_DATA_DIFFERS 1
404 /* For extent-same ioctl */
405 struct btrfs_ioctl_same_extent_info {
406 __s64 fd; /* in - destination file */
407 __u64 logical_offset; /* in - start of extent in destination */
408 __u64 bytes_deduped; /* out - total # of bytes we were able
409 * to dedupe from this file */
410 /* status of this dedupe operation:
411 * 0 if dedup succeeds
413 * == BTRFS_SAME_DATA_DIFFERS if data differs
415 __s32 status; /* out - see above description */
419 struct btrfs_ioctl_same_args {
420 __u64 logical_offset; /* in - start of extent in source */
421 __u64 length; /* in - length of extent */
422 __u16 dest_count; /* in - total elements in info array */
425 struct btrfs_ioctl_same_extent_info info[0];
427 BUILD_ASSERT(sizeof(struct btrfs_ioctl_same_args) == 24);
429 struct btrfs_ioctl_defrag_range_args {
430 /* start of the defrag operation */
433 /* number of bytes to defrag, use (u64)-1 to say all */
437 * flags for the operation, which can include turning
438 * on compression for this one defrag
443 * any extent bigger than this will be considered
444 * already defragged. Use 0 to take the kernel default
445 * Use 1 to say every single extent must be rewritten
450 * which compression method to use if turning on compression
451 * for this defrag operation. If unspecified, zlib will
456 /* spare for later */
459 BUILD_ASSERT(sizeof(struct btrfs_ioctl_defrag_range_args) == 48);
461 struct btrfs_ioctl_space_info {
467 struct btrfs_ioctl_space_args {
470 struct btrfs_ioctl_space_info spaces[0];
472 BUILD_ASSERT(sizeof(struct btrfs_ioctl_space_args) == 16);
474 struct btrfs_data_container {
475 __u32 bytes_left; /* out -- bytes not needed to deliver output */
476 __u32 bytes_missing; /* out -- additional bytes needed for result */
477 __u32 elem_cnt; /* out */
478 __u32 elem_missed; /* out */
479 __u64 val[0]; /* out */
482 struct btrfs_ioctl_ino_path_args {
486 /* struct btrfs_data_container *fspath; out */
487 __u64 fspath; /* out */
489 BUILD_ASSERT(sizeof(struct btrfs_ioctl_ino_path_args) == 56);
491 struct btrfs_ioctl_logical_ino_args {
492 __u64 logical; /* in */
495 /* struct btrfs_data_container *inodes; out */
499 enum btrfs_dev_stat_values {
500 /* disk I/O failure stats */
501 BTRFS_DEV_STAT_WRITE_ERRS, /* EIO or EREMOTEIO from lower layers */
502 BTRFS_DEV_STAT_READ_ERRS, /* EIO or EREMOTEIO from lower layers */
503 BTRFS_DEV_STAT_FLUSH_ERRS, /* EIO or EREMOTEIO from lower layers */
505 /* stats for indirect indications for I/O failures */
506 BTRFS_DEV_STAT_CORRUPTION_ERRS, /* checksum error, bytenr error or
507 * contents is illegal: this is an
508 * indication that the block was damaged
509 * during read or write, or written to
510 * wrong location or read from wrong
512 BTRFS_DEV_STAT_GENERATION_ERRS, /* an indication that blocks have not
515 BTRFS_DEV_STAT_VALUES_MAX
518 /* Reset statistics after reading; needs SYS_ADMIN capability */
519 #define BTRFS_DEV_STATS_RESET (1ULL << 0)
521 struct btrfs_ioctl_get_dev_stats {
522 __u64 devid; /* in */
523 __u64 nr_items; /* in/out */
524 __u64 flags; /* in/out */
527 __u64 values[BTRFS_DEV_STAT_VALUES_MAX];
529 __u64 unused[128 - 2 - BTRFS_DEV_STAT_VALUES_MAX]; /* pad to 1k + 8B */
531 BUILD_ASSERT(sizeof(struct btrfs_ioctl_get_dev_stats) == 1032);
533 /* BTRFS_IOC_SNAP_CREATE is no longer used by the btrfs command */
534 #define BTRFS_QUOTA_CTL_ENABLE 1
535 #define BTRFS_QUOTA_CTL_DISABLE 2
536 /* 3 has formerly been reserved for BTRFS_QUOTA_CTL_RESCAN */
537 struct btrfs_ioctl_quota_ctl_args {
541 BUILD_ASSERT(sizeof(struct btrfs_ioctl_quota_ctl_args) == 16);
543 struct btrfs_ioctl_quota_rescan_args {
548 BUILD_ASSERT(sizeof(struct btrfs_ioctl_quota_rescan_args) == 64);
550 struct btrfs_ioctl_qgroup_assign_args {
556 struct btrfs_ioctl_qgroup_create_args {
560 BUILD_ASSERT(sizeof(struct btrfs_ioctl_qgroup_create_args) == 16);
562 struct btrfs_ioctl_timespec {
567 struct btrfs_ioctl_received_subvol_args {
568 char uuid[BTRFS_UUID_SIZE]; /* in */
569 __u64 stransid; /* in */
570 __u64 rtransid; /* out */
571 struct btrfs_ioctl_timespec stime; /* in */
572 struct btrfs_ioctl_timespec rtime; /* out */
573 __u64 flags; /* in */
574 __u64 reserved[16]; /* in */
576 BUILD_ASSERT(sizeof(struct btrfs_ioctl_received_subvol_args) == 200);
579 * If we have a 32-bit userspace and 64-bit kernel, then the UAPI
580 * structures are incorrect, as the timespec structure from userspace
581 * is 4 bytes too small. We define these alternatives here for backward
582 * compatibility, the kernel understands both values.
586 * Structure size is different on 32bit and 64bit, has some padding if the
587 * structure is embedded. Packing makes sure the size is same on both, but will
588 * be misaligned on 64bit.
590 * NOTE: do not use in your code, this is for testing only
592 struct btrfs_ioctl_timespec_32 {
595 } __attribute__ ((__packed__));
597 struct btrfs_ioctl_received_subvol_args_32 {
598 char uuid[BTRFS_UUID_SIZE]; /* in */
599 __u64 stransid; /* in */
600 __u64 rtransid; /* out */
601 struct btrfs_ioctl_timespec_32 stime; /* in */
602 struct btrfs_ioctl_timespec_32 rtime; /* out */
603 __u64 flags; /* in */
604 __u64 reserved[16]; /* in */
605 } __attribute__ ((__packed__));
606 BUILD_ASSERT(sizeof(struct btrfs_ioctl_received_subvol_args_32) == 192);
608 #define BTRFS_IOC_SET_RECEIVED_SUBVOL_32_COMPAT_DEFINED 1
611 * Caller doesn't want file data in the send stream, even if the
612 * search of clone sources doesn't find an extent. UPDATE_EXTENT
613 * commands will be sent instead of WRITE commands.
615 #define BTRFS_SEND_FLAG_NO_FILE_DATA 0x1
618 * Do not add the leading stream header. Used when multiple snapshots
619 * are sent back to back.
621 #define BTRFS_SEND_FLAG_OMIT_STREAM_HEADER 0x2
624 * Omit the command at the end of the stream that indicated the end
625 * of the stream. This option is used when multiple snapshots are
628 #define BTRFS_SEND_FLAG_OMIT_END_CMD 0x4
630 #define BTRFS_SEND_FLAG_MASK \
631 (BTRFS_SEND_FLAG_NO_FILE_DATA | \
632 BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | \
633 BTRFS_SEND_FLAG_OMIT_END_CMD)
635 struct btrfs_ioctl_send_args {
636 __s64 send_fd; /* in */
637 __u64 clone_sources_count; /* in */
638 __u64 __user *clone_sources; /* in */
639 __u64 parent_root; /* in */
640 __u64 flags; /* in */
641 __u64 reserved[4]; /* in */
644 * Size of structure depends on pointer width, was not caught in the early
645 * days. Kernel handles pointer width differences transparently.
647 BUILD_ASSERT(sizeof(__u64 *) == 8
648 ? sizeof(struct btrfs_ioctl_send_args) == 72
649 : (sizeof(void *) == 4
650 ? sizeof(struct btrfs_ioctl_send_args) == 68
654 * Different pointer width leads to structure size change. Kernel should accept
655 * both ioctl values (derived from the structures) for backward compatibility.
656 * Size of this structure is same on 32bit and 64bit though.
658 * NOTE: do not use in your code, this is for testing only
660 struct btrfs_ioctl_send_args_64 {
661 __s64 send_fd; /* in */
662 __u64 clone_sources_count; /* in */
664 __u64 __user *clone_sources; /* in */
665 __u64 __clone_sources_alignment;
667 __u64 parent_root; /* in */
668 __u64 flags; /* in */
669 __u64 reserved[4]; /* in */
670 } __attribute__((packed));
671 BUILD_ASSERT(sizeof(struct btrfs_ioctl_send_args_64) == 72);
673 #define BTRFS_IOC_SEND_64_COMPAT_DEFINED 1
675 /* Error codes as returned by the kernel */
676 enum btrfs_err_code {
678 BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET,
679 BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET,
680 BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET,
681 BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET,
682 BTRFS_ERROR_DEV_TGT_REPLACE,
683 BTRFS_ERROR_DEV_MISSING_NOT_FOUND,
684 BTRFS_ERROR_DEV_ONLY_WRITABLE,
685 BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS
688 /* An error code to error string mapping for the kernel
691 static inline char *btrfs_err_str(enum btrfs_err_code err_code)
694 case BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET:
695 return "unable to go below two devices on raid1";
696 case BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET:
697 return "unable to go below four devices on raid10";
698 case BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET:
699 return "unable to go below two devices on raid5";
700 case BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET:
701 return "unable to go below three devices on raid6";
702 case BTRFS_ERROR_DEV_TGT_REPLACE:
703 return "unable to remove the dev_replace target dev";
704 case BTRFS_ERROR_DEV_MISSING_NOT_FOUND:
705 return "no missing devices found to remove";
706 case BTRFS_ERROR_DEV_ONLY_WRITABLE:
707 return "unable to remove the only writeable device";
708 case BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS:
709 return "add/delete/balance/replace/resize operation "
716 #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
717 struct btrfs_ioctl_vol_args)
718 #define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
719 struct btrfs_ioctl_vol_args)
720 #define BTRFS_IOC_RESIZE _IOW(BTRFS_IOCTL_MAGIC, 3, \
721 struct btrfs_ioctl_vol_args)
722 #define BTRFS_IOC_SCAN_DEV _IOW(BTRFS_IOCTL_MAGIC, 4, \
723 struct btrfs_ioctl_vol_args)
724 /* trans start and trans end are dangerous, and only for
725 * use by applications that know how to avoid the
726 * resulting deadlocks
728 #define BTRFS_IOC_TRANS_START _IO(BTRFS_IOCTL_MAGIC, 6)
729 #define BTRFS_IOC_TRANS_END _IO(BTRFS_IOCTL_MAGIC, 7)
730 #define BTRFS_IOC_SYNC _IO(BTRFS_IOCTL_MAGIC, 8)
732 #define BTRFS_IOC_CLONE _IOW(BTRFS_IOCTL_MAGIC, 9, int)
733 #define BTRFS_IOC_ADD_DEV _IOW(BTRFS_IOCTL_MAGIC, 10, \
734 struct btrfs_ioctl_vol_args)
735 #define BTRFS_IOC_RM_DEV _IOW(BTRFS_IOCTL_MAGIC, 11, \
736 struct btrfs_ioctl_vol_args)
737 #define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \
738 struct btrfs_ioctl_vol_args)
740 #define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \
741 struct btrfs_ioctl_clone_range_args)
743 #define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, \
744 struct btrfs_ioctl_vol_args)
745 #define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, \
746 struct btrfs_ioctl_vol_args)
747 #define BTRFS_IOC_DEFRAG_RANGE _IOW(BTRFS_IOCTL_MAGIC, 16, \
748 struct btrfs_ioctl_defrag_range_args)
749 #define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \
750 struct btrfs_ioctl_search_args)
751 #define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \
752 struct btrfs_ioctl_search_args_v2)
753 #define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \
754 struct btrfs_ioctl_ino_lookup_args)
755 #define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64)
756 #define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, \
757 struct btrfs_ioctl_space_args)
758 #define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64)
759 #define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64)
760 #define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \
761 struct btrfs_ioctl_vol_args_v2)
762 #define BTRFS_IOC_SUBVOL_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 24, \
763 struct btrfs_ioctl_vol_args_v2)
764 #define BTRFS_IOC_SUBVOL_GETFLAGS _IOR(BTRFS_IOCTL_MAGIC, 25, __u64)
765 #define BTRFS_IOC_SUBVOL_SETFLAGS _IOW(BTRFS_IOCTL_MAGIC, 26, __u64)
766 #define BTRFS_IOC_SCRUB _IOWR(BTRFS_IOCTL_MAGIC, 27, \
767 struct btrfs_ioctl_scrub_args)
768 #define BTRFS_IOC_SCRUB_CANCEL _IO(BTRFS_IOCTL_MAGIC, 28)
769 #define BTRFS_IOC_SCRUB_PROGRESS _IOWR(BTRFS_IOCTL_MAGIC, 29, \
770 struct btrfs_ioctl_scrub_args)
771 #define BTRFS_IOC_DEV_INFO _IOWR(BTRFS_IOCTL_MAGIC, 30, \
772 struct btrfs_ioctl_dev_info_args)
773 #define BTRFS_IOC_FS_INFO _IOR(BTRFS_IOCTL_MAGIC, 31, \
774 struct btrfs_ioctl_fs_info_args)
775 #define BTRFS_IOC_BALANCE_V2 _IOWR(BTRFS_IOCTL_MAGIC, 32, \
776 struct btrfs_ioctl_balance_args)
777 #define BTRFS_IOC_BALANCE_CTL _IOW(BTRFS_IOCTL_MAGIC, 33, int)
778 #define BTRFS_IOC_BALANCE_PROGRESS _IOR(BTRFS_IOCTL_MAGIC, 34, \
779 struct btrfs_ioctl_balance_args)
780 #define BTRFS_IOC_INO_PATHS _IOWR(BTRFS_IOCTL_MAGIC, 35, \
781 struct btrfs_ioctl_ino_path_args)
782 #define BTRFS_IOC_LOGICAL_INO _IOWR(BTRFS_IOCTL_MAGIC, 36, \
783 struct btrfs_ioctl_logical_ino_args)
784 #define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, \
785 struct btrfs_ioctl_received_subvol_args)
787 #ifdef BTRFS_IOC_SET_RECEIVED_SUBVOL_32_COMPAT_DEFINED
788 #define BTRFS_IOC_SET_RECEIVED_SUBVOL_32 _IOWR(BTRFS_IOCTL_MAGIC, 37, \
789 struct btrfs_ioctl_received_subvol_args_32)
792 #ifdef BTRFS_IOC_SEND_64_COMPAT_DEFINED
793 #define BTRFS_IOC_SEND_64 _IOW(BTRFS_IOCTL_MAGIC, 38, \
794 struct btrfs_ioctl_send_args_64)
797 #define BTRFS_IOC_SEND _IOW(BTRFS_IOCTL_MAGIC, 38, struct btrfs_ioctl_send_args)
798 #define BTRFS_IOC_DEVICES_READY _IOR(BTRFS_IOCTL_MAGIC, 39, \
799 struct btrfs_ioctl_vol_args)
800 #define BTRFS_IOC_QUOTA_CTL _IOWR(BTRFS_IOCTL_MAGIC, 40, \
801 struct btrfs_ioctl_quota_ctl_args)
802 #define BTRFS_IOC_QGROUP_ASSIGN _IOW(BTRFS_IOCTL_MAGIC, 41, \
803 struct btrfs_ioctl_qgroup_assign_args)
804 #define BTRFS_IOC_QGROUP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 42, \
805 struct btrfs_ioctl_qgroup_create_args)
806 #define BTRFS_IOC_QGROUP_LIMIT _IOR(BTRFS_IOCTL_MAGIC, 43, \
807 struct btrfs_ioctl_qgroup_limit_args)
808 #define BTRFS_IOC_QUOTA_RESCAN _IOW(BTRFS_IOCTL_MAGIC, 44, \
809 struct btrfs_ioctl_quota_rescan_args)
810 #define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \
811 struct btrfs_ioctl_quota_rescan_args)
812 #define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46)
813 #define BTRFS_IOC_GET_FSLABEL _IOR(BTRFS_IOCTL_MAGIC, 49, \
814 char[BTRFS_LABEL_SIZE])
815 #define BTRFS_IOC_SET_FSLABEL _IOW(BTRFS_IOCTL_MAGIC, 50, \
816 char[BTRFS_LABEL_SIZE])
817 #define BTRFS_IOC_GET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 52, \
818 struct btrfs_ioctl_get_dev_stats)
819 #define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \
820 struct btrfs_ioctl_dev_replace_args)
821 #define BTRFS_IOC_FILE_EXTENT_SAME _IOWR(BTRFS_IOCTL_MAGIC, 54, \
822 struct btrfs_ioctl_same_args)
823 #define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
824 struct btrfs_ioctl_feature_flags)
825 #define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \
826 struct btrfs_ioctl_feature_flags[2])
827 #define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
828 struct btrfs_ioctl_feature_flags[3])
829 #define BTRFS_IOC_RM_DEV_V2 _IOW(BTRFS_IOCTL_MAGIC, 58, \
830 struct btrfs_ioctl_vol_args_v2)