Skip to content

RFC btrfs send stream version 2

Howard McLauchlan linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6btrfs: send, bump stream versionfs/btrfs/send.c fs/btrfs/send.h include/uapi/linux/btrfs.h+46 -31 reply
2/6btrfs: send, implement total data size command to allow for progress estimationfs/btrfs/send.c+157 -320 replies
3/6btrfs: send, use fallocate command to punch holesfs/btrfs/send.c fs/btrfs/send.h+55 -30 replies
4/6btrfs: send, use fallocate command to allocate extentsfs/btrfs/send.c+53 -180 replies
5/6btrfs: add send_stream_version attribute to sysfsfs/btrfs/send.h fs/btrfs/sysfs.c+30 -01 reply
6/6btrfs: add chattr support for send/receivefs/btrfs/ctree.h fs/btrfs/ioctl.c fs/btrfs/send.c +1 more+159 -301 reply

Reviews trailers per patch

2 of 6 patches have a Reviewed-by or Acked-by.

PatchDavid SterbaOmar Sandoval
1/6R-b
2/6
3/6
4/6
5/6R-b R-b
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH 0/6] btrfs send stream version 2

In trying to implement support for inode flags in send/receive, the need for proper versioning/compatibility came up. I found some of Filipe's old patches
[1] for send stream v2 and rebased them on 4.17-rc4. My chattr changes are landed on top and also gated behind send stream v2. Similar was done for btrfs-progs (v4.16.1) [2] and a relevant xfstest (master) [3].

Unfortunately, since Filipe's changes are about 4 years old, rebasing required quite a few "I guess this is how it works" guesses. A critical eye would be greatly appreciated.

As of 4.17-rc4, commit a6aa10c70bf7 ("Btrfs: send, fix missing truncate for inode with prealloc extent past eof") is causing some strange behaviour with the rebased changes (this can be best seen in the xfstest output for btrfs/160). Specifically, the hole/data structure is consistent between sender/receiver, but the receiver is missing some information in fiemap for prealloc extents past eof. Filipe mentioned that his fix was considering the lack of fallocate command in send, so that's something we can look at if this patch set gets anywhere.

A few things I was unsure about:

- I couldn't use open_inode_for_write() in process_chattr() in btrfs-progs. Ended up having to open() with O_RDONLY. This is probably because I was setting immutable on the inode for my test cases.
- Filipe's original patches had BTRFS_SEND_{A/C}_INODE_FLAGS as placeholders, but I'd already implemented everything as BTRFS_SEND_{A/C}_CHATTR, since send_chown(), send_chmod(), etc. seemed to set a precedent in naming. If this needs to be changed let me know:

As of v4.17-rc4, these changes pass all "send" group xfstests.

Cheers, Howard

1: https://www.spinics.net/lists/linux-btrfs/msg35169.html
2: https://patchwork.kernel.org/patch/4021491/
3: https://patchwork.kernel.org/patch/4004861/

Filipe David Borba Manana (5):
btrfs: send, bump stream version
btrfs: send, implement total data size command to allow for progress
estimation
btrfs: send, use fallocate command to punch holes
btrfs: send, use fallocate command to allocate extents
btrfs: add send_stream_version attribute to sysfs

Howard McLauchlan (1):
btrfs: add chattr support for send/receive

 fs/btrfs/ctree.h           |   2 +
 fs/btrfs/ioctl.c           |   2 +-
 fs/btrfs/send.c            | 496 +++++++++++++++++++++++++++++++------
 fs/btrfs/send.h            |  26 +-
 fs/btrfs/sysfs.c           |  29 +++
 include/uapi/linux/btrfs.h |  21 +-
 6 files changed, 495 insertions(+), 81 deletions(-)
Signature · 1 line
2.17.0