Skip to content

Commit 31db9f7

Browse files
author
Alexander Block
committed
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: Alexander Block <[email protected]> Reviewed-by: David Sterba <[email protected]> Reviewed-by: Arne Jansen <[email protected]> Reviewed-by: Jan Schmidt <[email protected]> Reviewed-by: Alex Lyakas <[email protected]>
1 parent 7069830 commit 31db9f7

File tree

5 files changed

+4717
-1
lines changed

5 files changed

+4717
-1
lines changed

fs/btrfs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
88
extent_io.o volumes.o async-thread.o ioctl.o locking.o orphan.o \
99
export.o tree-log.o free-space-cache.o zlib.o lzo.o \
1010
compression.o delayed-ref.o relocation.o delayed-inode.o scrub.o \
11-
reada.o backref.o ulist.o
11+
reada.o backref.o ulist.o send.o
1212

1313
btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
1414
btrfs-$(CONFIG_BTRFS_FS_CHECK_INTEGRITY) += check-integrity.o

fs/btrfs/ioctl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include "inode-map.h"
5555
#include "backref.h"
5656
#include "rcu-string.h"
57+
#include "send.h"
5758

5859
/* Mask out flags that are inappropriate for the given type of inode. */
5960
static inline __u32 btrfs_mask_flags(umode_t mode, __u32 flags)
@@ -3571,6 +3572,8 @@ long btrfs_ioctl(struct file *file, unsigned int
35713572
return btrfs_ioctl_balance_progress(root, argp);
35723573
case BTRFS_IOC_SET_RECEIVED_SUBVOL:
35733574
return btrfs_ioctl_set_received_subvol(file, argp);
3575+
case BTRFS_IOC_SEND:
3576+
return btrfs_ioctl_send(file, argp);
35743577
case BTRFS_IOC_GET_DEV_STATS:
35753578
return btrfs_ioctl_get_dev_stats(root, argp, 0);
35763579
case BTRFS_IOC_GET_AND_RESET_DEV_STATS:

fs/btrfs/ioctl.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,15 @@ struct btrfs_ioctl_received_subvol_args {
310310
__u64 reserved[16]; /* in */
311311
};
312312

313+
struct btrfs_ioctl_send_args {
314+
__s64 send_fd; /* in */
315+
__u64 clone_sources_count; /* in */
316+
__u64 __user *clone_sources; /* in */
317+
__u64 parent_root; /* in */
318+
__u64 flags; /* in */
319+
__u64 reserved[4]; /* in */
320+
};
321+
313322
#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
314323
struct btrfs_ioctl_vol_args)
315324
#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
@@ -376,6 +385,7 @@ struct btrfs_ioctl_received_subvol_args {
376385
struct btrfs_ioctl_ino_path_args)
377386
#define BTRFS_IOC_SET_RECEIVED_SUBVOL _IOWR(BTRFS_IOCTL_MAGIC, 37, \
378387
struct btrfs_ioctl_received_subvol_args)
388+
#define BTRFS_IOC_SEND _IOW(BTRFS_IOCTL_MAGIC, 38, struct btrfs_ioctl_send_args)
379389
#define BTRFS_IOC_GET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 52, \
380390
struct btrfs_ioctl_get_dev_stats)
381391
#define BTRFS_IOC_GET_AND_RESET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 53, \

0 commit comments

Comments
 (0)