Skip to content

Commit

Permalink
erofs: enable long extended attribute name prefixes
Browse files Browse the repository at this point in the history
Let's enable long xattr name prefix feature.  Old kernels will just
ignore / skip such extended attributes so that in case you don't want
to mount such images.  Add another incompatible feature as an option
for this.

Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
  • Loading branch information
lostjeffle authored and intel-lab-lkp committed Apr 7, 2023
1 parent fe228ab commit 8cd5bbc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/erofs/erofs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#define EROFS_FEATURE_INCOMPAT_ZTAILPACKING 0x00000010
#define EROFS_FEATURE_INCOMPAT_FRAGMENTS 0x00000020
#define EROFS_FEATURE_INCOMPAT_DEDUPE 0x00000020
#define EROFS_FEATURE_INCOMPAT_XATTR_PREFIXES 0x00000040
#define EROFS_ALL_FEATURE_INCOMPAT \
(EROFS_FEATURE_INCOMPAT_ZERO_PADDING | \
EROFS_FEATURE_INCOMPAT_COMPR_CFGS | \
Expand All @@ -36,7 +37,8 @@
EROFS_FEATURE_INCOMPAT_COMPR_HEAD2 | \
EROFS_FEATURE_INCOMPAT_ZTAILPACKING | \
EROFS_FEATURE_INCOMPAT_FRAGMENTS | \
EROFS_FEATURE_INCOMPAT_DEDUPE)
EROFS_FEATURE_INCOMPAT_DEDUPE | \
EROFS_FEATURE_INCOMPAT_XATTR_PREFIXES)

#define EROFS_SB_EXTSLOT_SIZE 16

Expand Down
1 change: 1 addition & 0 deletions fs/erofs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ EROFS_FEATURE_FUNCS(compr_head2, incompat, INCOMPAT_COMPR_HEAD2)
EROFS_FEATURE_FUNCS(ztailpacking, incompat, INCOMPAT_ZTAILPACKING)
EROFS_FEATURE_FUNCS(fragments, incompat, INCOMPAT_FRAGMENTS)
EROFS_FEATURE_FUNCS(dedupe, incompat, INCOMPAT_DEDUPE)
EROFS_FEATURE_FUNCS(xattr_prefixes, incompat, INCOMPAT_XATTR_PREFIXES)
EROFS_FEATURE_FUNCS(sb_chksum, compat, COMPAT_SB_CHKSUM)

/* atomic flag definitions */
Expand Down
8 changes: 8 additions & 0 deletions fs/erofs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ static int erofs_read_superblock(struct super_block *sb)
sbi->packed_nid = le64_to_cpu(dsb->packed_nid);
sbi->inos = le64_to_cpu(dsb->inos);

sbi->xattr_prefix_start = le32_to_cpu(dsb->xattr_prefix_start);
sbi->xattr_prefix_count = dsb->xattr_prefix_count;

sbi->build_time = le64_to_cpu(dsb->build_time);
sbi->build_time_nsec = le32_to_cpu(dsb->build_time_nsec);

Expand Down Expand Up @@ -822,6 +825,10 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
if (err)
return err;

err = erofs_xattr_prefixes_init(sb);
if (err)
return err;

err = erofs_register_sysfs(sb);
if (err)
return err;
Expand Down Expand Up @@ -981,6 +988,7 @@ static void erofs_put_super(struct super_block *sb)

erofs_unregister_sysfs(sb);
erofs_shrinker_unregister(sb);
erofs_xattr_prefixes_cleanup(sb);
#ifdef CONFIG_EROFS_FS_ZIP
iput(sbi->managed_cache);
sbi->managed_cache = NULL;
Expand Down

0 comments on commit 8cd5bbc

Please sign in to comment.