mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-11-15 08:14:21 +08:00
btrfs-progs: Add support for BTRFS_SEND_FLAG_NO_FILE_DATA
The flag and command are synced from kernel to user. Also, this patch adds a callback for the BTRFS_SEND_C_UPDATE_EXTENT in struct btrfs_send_ops. read_and_process_cmd() is updated to decode BTRFS_SEND_C_UPDATE_EXTENT and send the values through the right callback. I did not add a callback definition to cmds-receive.c as that code never uses BTRFS_SEND_FLAG_NO_FILE_DATA. Signed-off-by: Mark Fasheh <mfasheh@suse.de>
This commit is contained in:
parent
e43cc46155
commit
fac5b559a7
7
ioctl.h
7
ioctl.h
@ -364,6 +364,13 @@ struct btrfs_ioctl_received_subvol_args {
|
||||
__u64 reserved[16]; /* in */
|
||||
};
|
||||
|
||||
/*
|
||||
* Caller doesn't want file data in the send stream, even if the
|
||||
* 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
|
||||
|
||||
struct btrfs_ioctl_send_args {
|
||||
__s64 send_fd; /* in */
|
||||
__u64 clone_sources_count; /* in */
|
||||
|
@ -418,6 +418,12 @@ static int read_and_process_cmd(struct btrfs_send_stream *s)
|
||||
TLV_GET_TIMESPEC(s, BTRFS_SEND_A_CTIME, &ct);
|
||||
ret = s->ops->utimes(path, &at, &mt, &ct, s->user);
|
||||
break;
|
||||
case BTRFS_SEND_C_UPDATE_EXTENT:
|
||||
TLV_GET_STRING(s, BTRFS_SEND_A_PATH, &path);
|
||||
TLV_GET_U64(s, BTRFS_SEND_A_FILE_OFFSET, &offset);
|
||||
TLV_GET_U64(s, BTRFS_SEND_A_SIZE, &tmp);
|
||||
ret = s->ops->update_extent(path, offset, tmp, s->user);
|
||||
break;
|
||||
case BTRFS_SEND_C_END:
|
||||
ret = 1;
|
||||
break;
|
||||
|
@ -49,6 +49,7 @@ struct btrfs_send_ops {
|
||||
int (*utimes)(const char *path, struct timespec *at,
|
||||
struct timespec *mt, struct timespec *ct,
|
||||
void *user);
|
||||
int (*update_extent)(const char *path, u64 offset, u64 len, void *user);
|
||||
};
|
||||
|
||||
int btrfs_read_and_process_send_stream(int fd,
|
||||
|
Loading…
Reference in New Issue
Block a user