summaryrefslogtreecommitdiff
path: root/fs/btrfs/send.h
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2022-05-18 19:02:55 +0300
committerDavid Sterba <dsterba@suse.com>2022-07-25 18:45:38 +0300
commit4824735918a1b7f79cdb310aa365c239be10ae5d (patch)
tree2ab54d1e07ec509d8daf09ace6a7da17df9468df /fs/btrfs/send.h
parent22a5b2abb7340cb05a34eb47d0271a6714cf5e3f (diff)
downloadlinux-4824735918a1b7f79cdb310aa365c239be10ae5d.tar.xz
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>
Diffstat (limited to 'fs/btrfs/send.h')
-rw-r--r--fs/btrfs/send.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/btrfs/send.h b/fs/btrfs/send.h
index 7f615ddc8d9c..4bb4e6a638cb 100644
--- a/fs/btrfs/send.h
+++ b/fs/btrfs/send.h
@@ -88,7 +88,7 @@ enum btrfs_send_cmd {
/* Version 2 */
BTRFS_SEND_C_FALLOCATE = 23,
- BTRFS_SEND_C_SETFLAGS = 24,
+ BTRFS_SEND_C_FILEATTR = 24,
BTRFS_SEND_C_ENCODED_WRITE = 25,
BTRFS_SEND_C_MAX_V2 = 25,
@@ -141,7 +141,13 @@ enum {
/* Version 2 */
BTRFS_SEND_A_FALLOCATE_MODE = 25,
- BTRFS_SEND_A_SETFLAGS_FLAGS = 26,
+ /*
+ * File attributes from the FS_*_FL namespace (i_flags, xflags),
+ * translated to BTRFS_INODE_* bits (BTRFS_INODE_FLAG_MASK) and stored
+ * in btrfs_inode_item::flags (represented by btrfs_inode::flags and
+ * btrfs_inode::ro_flags).
+ */
+ BTRFS_SEND_A_FILEATTR = 26,
BTRFS_SEND_A_UNENCODED_FILE_LEN = 27,
BTRFS_SEND_A_UNENCODED_LEN = 28,