Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 374863
b: refs/heads/master
c: c2c7132
h: refs/heads/master
i:
  374861: 285a3a0
  374859: 27edaa8
  374855: 2649459
  374847: 1ecfc74
v: v3
  • Loading branch information
Stefan Behrens authored and Josef Bacik committed May 6, 2013
1 parent 6d8dd74 commit 664ad5e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 692206b153ea0d08d6015521ed27a6739cbf6f9f
refs/heads/master: c2c71324ecb471c932bc1ff59e46ffcf82f274fc
24 changes: 14 additions & 10 deletions trunk/fs/btrfs/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -4529,9 +4529,11 @@ static int send_subvol(struct send_ctx *sctx)
{
int ret;

ret = send_header(sctx);
if (ret < 0)
goto out;
if (!(sctx->flags & BTRFS_SEND_FLAG_OMIT_STREAM_HEADER)) {
ret = send_header(sctx);
if (ret < 0)
goto out;
}

ret = send_subvol_begin(sctx);
if (ret < 0)
Expand Down Expand Up @@ -4593,7 +4595,7 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
goto out;
}

if (arg->flags & ~BTRFS_SEND_FLAG_NO_FILE_DATA) {
if (arg->flags & ~BTRFS_SEND_FLAG_MASK) {
ret = -EINVAL;
goto out;
}
Expand Down Expand Up @@ -4704,12 +4706,14 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
if (ret < 0)
goto out;

ret = begin_cmd(sctx, BTRFS_SEND_C_END);
if (ret < 0)
goto out;
ret = send_cmd(sctx);
if (ret < 0)
goto out;
if (!(sctx->flags & BTRFS_SEND_FLAG_OMIT_END_CMD)) {
ret = begin_cmd(sctx, BTRFS_SEND_C_END);
if (ret < 0)
goto out;
ret = send_cmd(sctx);
if (ret < 0)
goto out;
}

out:
kfree(arg);
Expand Down
20 changes: 19 additions & 1 deletion trunk/include/uapi/linux/btrfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,25 @@ struct btrfs_ioctl_received_subvol_args {
* search of clone sources doesn't find an extent. UPDATE_EXTENT
* commands will be sent instead of WRITE commands.
*/
#define BTRFS_SEND_FLAG_NO_FILE_DATA 0x1
#define BTRFS_SEND_FLAG_NO_FILE_DATA 0x1

/*
* Do not add the leading stream header. Used when multiple snapshots
* are sent back to back.
*/
#define BTRFS_SEND_FLAG_OMIT_STREAM_HEADER 0x2

/*
* Omit the command at the end of the stream that indicated the end
* of the stream. This option is used when multiple snapshots are
* sent back to back.
*/
#define BTRFS_SEND_FLAG_OMIT_END_CMD 0x4

#define BTRFS_SEND_FLAG_MASK \
(BTRFS_SEND_FLAG_NO_FILE_DATA | \
BTRFS_SEND_FLAG_OMIT_STREAM_HEADER | \
BTRFS_SEND_FLAG_OMIT_END_CMD)

struct btrfs_ioctl_send_args {
__s64 send_fd; /* in */
Expand Down

0 comments on commit 664ad5e

Please sign in to comment.