Re: [PATCH RFC] btrfs: send: v2 protocol and example OTIME changes
From: Omar Sandoval <osandov@osandov.com>
Date: 2021-10-19 17:38:37
On Mon, Oct 18, 2021 at 04:41:09PM +0200, David Sterba wrote:
This is send protocol update to version 2 with example new commands. We have many pending protocol update requests but still don't have the basic protocol rev in place, the first thing that must happen is to do the actual versioning support. In order to have something to test, there's an extended and a new command, that should be otherwise harmless and nobody should depend on it. This should be enough to validate the non-protocol changes and backward compatibility before we do the big protocol update. The protocol version is u32 and is a new member in the send ioctl struct. Validity of the version field is backed by a new flag bit. Old kernels would fail when a higher version is requested. Version protocol 0 will pick the highest supported version, BTRFS_SEND_STREAM_VERSION, that's also exported in sysfs. Protocol changes: - new command BTRFS_SEND_C_UTIMES2 - appends OTIME after the output of BTRFS_SEND_C_UTIMES - this is an example how to extend an existing command based on protocol version - new command BTRFS_SEND_C_OTIME - path BTRFS_SEND_A_PATH - timespec attribute BTRFS_SEND_A_OTIME - it's a separate command so it does not bloat any UTIMES2 commands, and is emitted only after inode creation (file, dir, special files).
Why do we need new commands for otime? I think it would make the most
sense to include the BTRFS_SEND_A_OTIME attribute with an existing
command: either the BTRFS_SEND_C_MK{DIR,FILE,NOD,FIFO,SOCK} command, or
the first BTRFS_SEND_C_UTIME command after creation. We might as well
take advantage of the TLV protocol, which allows us to add or remove
attributes for commands as needed.