erofs-utils: update on-disk format for xattr name filter
authorJingbo Xu <jefflexu@linux.alibaba.com>
Tue, 29 Aug 2023 14:55:03 +0000 (22:55 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 31 Aug 2023 00:48:38 +0000 (08:48 +0800)
Let's keep in sync with kernel commit 3f339920175c ("erofs: update
on-disk format for xattr name filter").

Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230829145504.93567-3-jefflexu@linux.alibaba.com
[ Gao Xiang: truncate the commit message. ]
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
include/erofs_fs.h

index 850438a72d863d17f6dd0dfdb8af7bcbbe4d7f6c..bdc946ac0c783123a3262028142376a9d5ad0e94 100644 (file)
@@ -14,6 +14,7 @@
 
 #define EROFS_FEATURE_COMPAT_SB_CHKSUM          0x00000001
 #define EROFS_FEATURE_COMPAT_MTIME              0x00000002
+#define EROFS_FEATURE_COMPAT_XATTR_FILTER      0x00000004
 
 /*
  * Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should
@@ -82,7 +83,8 @@ struct erofs_super_block {
        __u8 xattr_prefix_count;        /* # of long xattr name prefixes */
        __le32 xattr_prefix_start;      /* start of long xattr prefixes */
        __le64 packed_nid;      /* nid of the special packed inode */
-       __u8 reserved2[24];
+       __u8 xattr_filter_reserved; /* reserved for xattr name filter */
+       __u8 reserved2[23];
 };
 
 /*
@@ -201,7 +203,7 @@ struct erofs_inode_extended {
  * for read-only fs, no need to introduce h_refcount
  */
 struct erofs_xattr_ibody_header {
-       __le32 h_reserved;
+       __le32 h_name_filter;           /* bit value 1 indicates not-present */
        __u8   h_shared_count;
        __u8   h_reserved2[7];
        __le32 h_shared_xattrs[0];      /* shared xattr id array */
@@ -222,6 +224,10 @@ struct erofs_xattr_ibody_header {
 #define EROFS_XATTR_LONG_PREFIX                0x80
 #define EROFS_XATTR_LONG_PREFIX_MASK   0x7f
 
+#define EROFS_XATTR_FILTER_BITS                32
+#define EROFS_XATTR_FILTER_DEFAULT     UINT32_MAX
+#define EROFS_XATTR_FILTER_SEED                0x25BBE08F
+
 /* xattr entry (for both inline & shared xattrs) */
 struct erofs_xattr_entry {
        __u8   e_name_len;      /* length of name */