Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31db9f7c authored by Alexander Block's avatar Alexander Block
Browse files

Btrfs: introduce BTRFS_IOC_SEND for btrfs send/receive



This patch introduces the BTRFS_IOC_SEND ioctl that is
required for send. It allows btrfs-progs to implement
full and incremental sends. Patches for btrfs-progs will
follow.

Signed-off-by: default avatarAlexander Block <ablock84@googlemail.com>
Reviewed-by: default avatarDavid Sterba <dave@jikos.cz>
Reviewed-by: default avatarArne Jansen <sensille@gmx.net>
Reviewed-by: default avatarJan Schmidt <list.btrfs@jan-o-sch.net>
Reviewed-by: default avatarAlex Lyakas <alex.bolshoy.btrfs@gmail.com>
parent 7069830a
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -8,7 +8,7 @@ btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
	   extent_io.o volumes.o async-thread.o ioctl.o locking.o orphan.o \
	   extent_io.o volumes.o async-thread.o ioctl.o locking.o orphan.o \
	   export.o tree-log.o free-space-cache.o zlib.o lzo.o \
	   export.o tree-log.o free-space-cache.o zlib.o lzo.o \
	   compression.o delayed-ref.o relocation.o delayed-inode.o scrub.o \
	   compression.o delayed-ref.o relocation.o delayed-inode.o scrub.o \
	   reada.o backref.o ulist.o
	   reada.o backref.o ulist.o send.o


btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
btrfs-$(CONFIG_BTRFS_FS_CHECK_INTEGRITY) += check-integrity.o
btrfs-$(CONFIG_BTRFS_FS_CHECK_INTEGRITY) += check-integrity.o
+3 −0
Original line number Original line Diff line number Diff line
@@ -54,6 +54,7 @@
#include "inode-map.h"
#include "inode-map.h"
#include "backref.h"
#include "backref.h"
#include "rcu-string.h"
#include "rcu-string.h"
#include "send.h"


/* Mask out flags that are inappropriate for the given type of inode. */
/* Mask out flags that are inappropriate for the given type of inode. */
static inline __u32 btrfs_mask_flags(umode_t mode, __u32 flags)
static inline __u32 btrfs_mask_flags(umode_t mode, __u32 flags)
@@ -3571,6 +3572,8 @@ long btrfs_ioctl(struct file *file, unsigned int
		return btrfs_ioctl_balance_progress(root, argp);
		return btrfs_ioctl_balance_progress(root, argp);
	case BTRFS_IOC_SET_RECEIVED_SUBVOL:
	case BTRFS_IOC_SET_RECEIVED_SUBVOL:
		return btrfs_ioctl_set_received_subvol(file, argp);
		return btrfs_ioctl_set_received_subvol(file, argp);
	case BTRFS_IOC_SEND:
		return btrfs_ioctl_send(file, argp);
	case BTRFS_IOC_GET_DEV_STATS:
	case BTRFS_IOC_GET_DEV_STATS:
		return btrfs_ioctl_get_dev_stats(root, argp, 0);
		return btrfs_ioctl_get_dev_stats(root, argp, 0);
	case BTRFS_IOC_GET_AND_RESET_DEV_STATS:
	case BTRFS_IOC_GET_AND_RESET_DEV_STATS:
+10 −0
Original line number Original line Diff line number Diff line
@@ -310,6 +310,15 @@ struct btrfs_ioctl_received_subvol_args {
	__u64	reserved[16];		/* in */
	__u64	reserved[16];		/* in */
};
};


struct btrfs_ioctl_send_args {
	__s64 send_fd;			/* in */
	__u64 clone_sources_count;	/* in */
	__u64 __user *clone_sources;	/* in */
	__u64 parent_root;		/* in */
	__u64 flags;			/* in */
	__u64 reserved[4];		/* in */
};

#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
				   struct btrfs_ioctl_vol_args)
				   struct btrfs_ioctl_vol_args)
#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
@@ -376,6 +385,7 @@ struct btrfs_ioctl_received_subvol_args {
					struct btrfs_ioctl_ino_path_args)
					struct btrfs_ioctl_ino_path_args)
#define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, \
#define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, \
				struct btrfs_ioctl_received_subvol_args)
				struct btrfs_ioctl_received_subvol_args)
#define BTRFS_IOC_SEND _IOW(BTRFS_IOCTL_MAGIC, 38, struct btrfs_ioctl_send_args)
#define BTRFS_IOC_GET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 52, \
#define BTRFS_IOC_GET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 52, \
				      struct btrfs_ioctl_get_dev_stats)
				      struct btrfs_ioctl_get_dev_stats)
#define BTRFS_IOC_GET_AND_RESET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 53, \
#define BTRFS_IOC_GET_AND_RESET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 53, \