btrfs: send: add new command FILEATTR for file attributes
authorDavid Sterba <dsterba@suse.com>
Wed, 18 May 2022 16:02:55 +0000 (18:02 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 Jul 2022 15:45:38 +0000 (17:45 +0200)
commit4824735918a1b7f79cdb310aa365c239be10ae5d
tree2ab54d1e07ec509d8daf09ace6a7da17df9468df
parent22a5b2abb7340cb05a34eb47d0271a6714cf5e3f
btrfs: send: add new command FILEATTR for file attributes

There are file attributes inherited from previous ext2 SETFLAGS/GETFLAGS
and later from XFLAGS interfaces, now commonly found under the
'fileattr' API. This corresponds to the individual inode bits and that's
part of the on-disk format, so this is suitable for the protocol. The
other interfaces contain a lot of cruft or bits that btrfs does not
support yet.

Currently the value is u64 and matches btrfs_inode_item. Not all the
bits can be set by ioctls (like NODATASUM or READONLY), but we can send
them over the protocol and leave it up to the receiving side what and
how to apply.

As some of the flags, eg. IMMUTABLE, can prevent any further changes,
the receiving side needs to understand that and apply the changes in the
right order, or possibly with some intermediate steps. This should be
easier, future proof and simpler on the protocol layer than implementing
in kernel.

Reviewed-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/send.c
fs/btrfs/send.h