diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-11-17 21:02:50 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-11-17 21:02:50 -0500 |
commit | 3de4586c5278a28107030c336956381f69ff7a9d (patch) | |
tree | d636e3806cd5ecff71927d0300e46526fa23de1a /fs/btrfs/ioctl.h | |
parent | 4ce4cb526f67775c1cce3e3fa01c292672ba874e (diff) |
Btrfs: Allow subvolumes and snapshots anywhere in the directory tree
Before, all snapshots and subvolumes lived in a single flat directory. This
was awkward and confusing because the single flat directory was only writable
with the ioctls.
This commit changes the ioctls to create subvols and snapshots at any
point in the directory tree. This requires making separate ioctls for
snapshot and subvol creation instead of a combining them into one.
The subvol ioctl does:
btrfsctl -S subvol_name parent_dir
After the ioctl is done subvol_name lives inside parent_dir.
The snapshot ioctl does:
btrfsctl -s path_for_snapshot root_to_snapshot
path_for_snapshot can be an absolute or relative path. btrfsctl breaks it up
into directory and basename components.
root_to_snapshot can be any file or directory in the FS. The snapshot
is taken of the entire root where that file lives.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ioctl.h')
-rw-r--r-- | fs/btrfs/ioctl.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h index 989ba8a01215..78049ea208db 100644 --- a/fs/btrfs/ioctl.h +++ b/fs/btrfs/ioctl.h | |||
@@ -22,9 +22,10 @@ | |||
22 | 22 | ||
23 | #define BTRFS_IOCTL_MAGIC 0x94 | 23 | #define BTRFS_IOCTL_MAGIC 0x94 |
24 | #define BTRFS_VOL_NAME_MAX 255 | 24 | #define BTRFS_VOL_NAME_MAX 255 |
25 | #define BTRFS_PATH_NAME_MAX 4095 | 25 | #define BTRFS_PATH_NAME_MAX 3072 |
26 | 26 | ||
27 | struct btrfs_ioctl_vol_args { | 27 | struct btrfs_ioctl_vol_args { |
28 | __s64 fd; | ||
28 | char name[BTRFS_PATH_NAME_MAX + 1]; | 29 | char name[BTRFS_PATH_NAME_MAX + 1]; |
29 | }; | 30 | }; |
30 | 31 | ||
@@ -51,7 +52,6 @@ struct btrfs_ioctl_vol_args { | |||
51 | struct btrfs_ioctl_vol_args) | 52 | struct btrfs_ioctl_vol_args) |
52 | #define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \ | 53 | #define BTRFS_IOC_BALANCE _IOW(BTRFS_IOCTL_MAGIC, 12, \ |
53 | struct btrfs_ioctl_vol_args) | 54 | struct btrfs_ioctl_vol_args) |
54 | |||
55 | struct btrfs_ioctl_clone_range_args { | 55 | struct btrfs_ioctl_clone_range_args { |
56 | __s64 src_fd; | 56 | __s64 src_fd; |
57 | __u64 src_offset, src_length; | 57 | __u64 src_offset, src_length; |
@@ -61,4 +61,7 @@ struct btrfs_ioctl_clone_range_args { | |||
61 | #define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \ | 61 | #define BTRFS_IOC_CLONE_RANGE _IOW(BTRFS_IOCTL_MAGIC, 13, \ |
62 | struct btrfs_ioctl_clone_range_args) | 62 | struct btrfs_ioctl_clone_range_args) |
63 | 63 | ||
64 | #define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, \ | ||
65 | struct btrfs_ioctl_vol_args) | ||
66 | |||
64 | #endif | 67 | #endif |