From nobody Wed Feb 11 14:04:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F323BC77B6F for ; Fri, 7 Apr 2023 14:17:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240235AbjDGORZ (ORCPT ); Fri, 7 Apr 2023 10:17:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230082AbjDGORS (ORCPT ); Fri, 7 Apr 2023 10:17:18 -0400 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7D4A6EB5 for ; Fri, 7 Apr 2023 07:17:15 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R671e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VfX2QQC_1680877032; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VfX2QQC_1680877032) by smtp.aliyun-inc.com; Fri, 07 Apr 2023 22:17:12 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/7] erofs: keep meta inode into erofs_buf Date: Fri, 7 Apr 2023 22:17:04 +0800 Message-Id: <20230407141710.113882-2-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20230407141710.113882-1-jefflexu@linux.alibaba.com> References: <20230407141710.113882-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gao Xiang So that erofs_read_metadata() can read metadata from other inodes (e.g. packed inode) as well. Signed-off-by: Gao Xiang Acked-by: Chao Yu --- fs/erofs/data.c | 23 ++++++++++++++--------- fs/erofs/dir.c | 3 ++- fs/erofs/internal.h | 6 ++++-- fs/erofs/namei.c | 4 +++- fs/erofs/super.c | 6 +++--- fs/erofs/zdata.c | 4 ++-- 6 files changed, 28 insertions(+), 18 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index e5458b4c3d0c..aa7f9e4f86fb 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -31,11 +31,11 @@ void erofs_put_metabuf(struct erofs_buf *buf) * Derive the block size from inode->i_blkbits to make compatible with * anonymous inode in fscache mode. */ -void *erofs_bread(struct erofs_buf *buf, struct inode *inode, - erofs_blk_t blkaddr, enum erofs_kmap_type type) +void *erofs_bread(struct erofs_buf *buf, erofs_blk_t blkaddr, + enum erofs_kmap_type type) { + struct inode *inode =3D buf->inode; erofs_off_t offset =3D blkaddr << inode->i_blkbits; - struct address_space *const mapping =3D inode->i_mapping; pgoff_t index =3D offset >> PAGE_SHIFT; struct page *page =3D buf->page; struct folio *folio; @@ -45,7 +45,7 @@ void *erofs_bread(struct erofs_buf *buf, struct inode *in= ode, erofs_put_metabuf(buf); =20 nofs_flag =3D memalloc_nofs_save(); - folio =3D read_cache_folio(mapping, index, NULL, NULL); + folio =3D read_cache_folio(inode->i_mapping, index, NULL, NULL); memalloc_nofs_restore(nofs_flag); if (IS_ERR(folio)) return folio; @@ -67,14 +67,19 @@ void *erofs_bread(struct erofs_buf *buf, struct inode *= inode, return buf->base + (offset & ~PAGE_MASK); } =20 -void *erofs_read_metabuf(struct erofs_buf *buf, struct super_block *sb, - erofs_blk_t blkaddr, enum erofs_kmap_type type) +void erofs_init_metabuf(struct erofs_buf *buf, struct super_block *sb) { if (erofs_is_fscache_mode(sb)) - return erofs_bread(buf, EROFS_SB(sb)->s_fscache->inode, - blkaddr, type); + buf->inode =3D EROFS_SB(sb)->s_fscache->inode; + else + buf->inode =3D sb->s_bdev->bd_inode; +} =20 - return erofs_bread(buf, sb->s_bdev->bd_inode, blkaddr, type); +void *erofs_read_metabuf(struct erofs_buf *buf, struct super_block *sb, + erofs_blk_t blkaddr, enum erofs_kmap_type type) +{ + erofs_init_metabuf(buf, sb); + return erofs_bread(buf, blkaddr, type); } =20 static int erofs_map_blocks_flatmode(struct inode *inode, diff --git a/fs/erofs/dir.c b/fs/erofs/dir.c index 963bbed0b699..b80abec0531a 100644 --- a/fs/erofs/dir.c +++ b/fs/erofs/dir.c @@ -58,11 +58,12 @@ static int erofs_readdir(struct file *f, struct dir_con= text *ctx) int err =3D 0; bool initial =3D true; =20 + buf.inode =3D dir; while (ctx->pos < dirsize) { struct erofs_dirent *de; unsigned int nameoff, maxsize; =20 - de =3D erofs_bread(&buf, dir, i, EROFS_KMAP); + de =3D erofs_bread(&buf, i, EROFS_KMAP); if (IS_ERR(de)) { erofs_err(sb, "fail to readdir of logical block %u of nid %llu", i, EROFS_I(dir)->nid); diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index e30a4fd43ccb..2bcff3194e4a 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -247,6 +247,7 @@ enum erofs_kmap_type { }; =20 struct erofs_buf { + struct inode *inode; struct page *page; void *base; enum erofs_kmap_type kmap_type; @@ -440,8 +441,9 @@ extern const struct iomap_ops z_erofs_iomap_report_ops; =20 void erofs_unmap_metabuf(struct erofs_buf *buf); void erofs_put_metabuf(struct erofs_buf *buf); -void *erofs_bread(struct erofs_buf *buf, struct inode *inode, - erofs_blk_t blkaddr, enum erofs_kmap_type type); +void *erofs_bread(struct erofs_buf *buf, erofs_blk_t blkaddr, + enum erofs_kmap_type type); +void erofs_init_metabuf(struct erofs_buf *buf, struct super_block *sb); void *erofs_read_metabuf(struct erofs_buf *buf, struct super_block *sb, erofs_blk_t blkaddr, enum erofs_kmap_type type); int erofs_map_dev(struct super_block *sb, struct erofs_map_dev *dev); diff --git a/fs/erofs/namei.c b/fs/erofs/namei.c index f091e9a0f0a1..43096bac4c99 100644 --- a/fs/erofs/namei.c +++ b/fs/erofs/namei.c @@ -99,7 +99,8 @@ static void *erofs_find_target_block(struct erofs_buf *ta= rget, struct erofs_buf buf =3D __EROFS_BUF_INITIALIZER; struct erofs_dirent *de; =20 - de =3D erofs_bread(&buf, dir, mid, EROFS_KMAP); + buf.inode =3D dir; + de =3D erofs_bread(&buf, mid, EROFS_KMAP); if (!IS_ERR(de)) { const int nameoff =3D nameoff_from_disk(de->nameoff, bsz); const int ndirents =3D nameoff / sizeof(*de); @@ -170,6 +171,7 @@ int erofs_namei(struct inode *dir, const struct qstr *n= ame, erofs_nid_t *nid, =20 qn.name =3D name->name; qn.end =3D name->name + name->len; + buf.inode =3D dir; =20 ndirents =3D 0; de =3D erofs_find_target_block(&buf, dir, &qn, &ndirents); diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 9e56a6fb2267..58ffbf410bfb 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -135,7 +135,7 @@ static void *erofs_read_metadata(struct super_block *sb= , struct erofs_buf *buf, int len, i, cnt; =20 *offset =3D round_up(*offset, 4); - ptr =3D erofs_read_metabuf(buf, sb, erofs_blknr(sb, *offset), EROFS_KMAP); + ptr =3D erofs_bread(buf, erofs_blknr(sb, *offset), EROFS_KMAP); if (IS_ERR(ptr)) return ptr; =20 @@ -151,8 +151,7 @@ static void *erofs_read_metadata(struct super_block *sb= , struct erofs_buf *buf, for (i =3D 0; i < len; i +=3D cnt) { cnt =3D min_t(int, sb->s_blocksize - erofs_blkoff(sb, *offset), len - i); - ptr =3D erofs_read_metabuf(buf, sb, erofs_blknr(sb, *offset), - EROFS_KMAP); + ptr =3D erofs_bread(buf, erofs_blknr(sb, *offset), EROFS_KMAP); if (IS_ERR(ptr)) { kfree(buffer); return ptr; @@ -179,6 +178,7 @@ static int erofs_load_compr_cfgs(struct super_block *sb, return -EINVAL; } =20 + erofs_init_metabuf(&buf, sb); offset =3D EROFS_SUPER_OFFSET + sbi->sb_size; alg =3D 0; for (algs =3D sbi->available_compr_algs; algs; algs >>=3D 1, ++alg) { diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index a90d37c7bdd7..34944e400037 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -939,12 +939,12 @@ static int z_erofs_read_fragment(struct inode *inode,= erofs_off_t pos, if (!packed_inode) return -EFSCORRUPTED; =20 + buf.inode =3D packed_inode; pos +=3D EROFS_I(inode)->z_fragmentoff; for (i =3D 0; i < len; i +=3D cnt) { cnt =3D min_t(unsigned int, len - i, sb->s_blocksize - erofs_blkoff(sb, pos)); - src =3D erofs_bread(&buf, packed_inode, - erofs_blknr(sb, pos), EROFS_KMAP); + src =3D erofs_bread(&buf, erofs_blknr(sb, pos), EROFS_KMAP); if (IS_ERR(src)) { erofs_put_metabuf(&buf); return PTR_ERR(src); --=20 2.19.1.6.gb485710b From nobody Wed Feb 11 14:04:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88ADEC6FD1D for ; Fri, 7 Apr 2023 14:17:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240383AbjDGOR2 (ORCPT ); Fri, 7 Apr 2023 10:17:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231349AbjDGORS (ORCPT ); Fri, 7 Apr 2023 10:17:18 -0400 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 387876E95 for ; Fri, 7 Apr 2023 07:17:17 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R281e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VfX8evk_1680877033; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VfX8evk_1680877033) by smtp.aliyun-inc.com; Fri, 07 Apr 2023 22:17:13 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/7] erofs: initialize packed inode after root inode is assigned Date: Fri, 7 Apr 2023 22:17:05 +0800 Message-Id: <20230407141710.113882-3-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20230407141710.113882-1-jefflexu@linux.alibaba.com> References: <20230407141710.113882-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" As commit 8f7acdae2cd4 ("staging: erofs: kill all failure handling in fill_super()"), move the initialization of packed inode after root inode is assigned, so that the iput() in .put_super() is adequate as the failure handling. Otherwise, iput() is also needed in .kill_sb(), in case of the mounting fails halfway. Signed-off-by: Jingbo Xu Acked-by: Chao Yu Reviewed-by: Gao Xiang Reviewed-by: Yue Hu --- fs/erofs/internal.h | 1 + fs/erofs/super.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 2bcff3194e4a..caea9dc1cd82 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -157,6 +157,7 @@ struct erofs_sb_info { =20 /* what we really care is nid, rather than ino.. */ erofs_nid_t root_nid; + erofs_nid_t packed_nid; /* used for statfs, f_files - f_favail */ u64 inos; =20 diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 58ffbf410bfb..325602820dc8 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -388,17 +388,7 @@ static int erofs_read_superblock(struct super_block *s= b) #endif sbi->islotbits =3D ilog2(sizeof(struct erofs_inode_compact)); sbi->root_nid =3D le16_to_cpu(dsb->root_nid); -#ifdef CONFIG_EROFS_FS_ZIP - sbi->packed_inode =3D NULL; - if (erofs_sb_has_fragments(sbi) && dsb->packed_nid) { - sbi->packed_inode =3D - erofs_iget(sb, le64_to_cpu(dsb->packed_nid)); - if (IS_ERR(sbi->packed_inode)) { - ret =3D PTR_ERR(sbi->packed_inode); - goto out; - } - } -#endif + sbi->packed_nid =3D le64_to_cpu(dsb->packed_nid); sbi->inos =3D le64_to_cpu(dsb->inos); =20 sbi->build_time =3D le64_to_cpu(dsb->build_time); @@ -820,6 +810,16 @@ static int erofs_fc_fill_super(struct super_block *sb,= struct fs_context *fc) =20 erofs_shrinker_register(sb); /* sb->s_umount is already locked, SB_ACTIVE and SB_BORN are not set */ +#ifdef CONFIG_EROFS_FS_ZIP + if (erofs_sb_has_fragments(sbi) && sbi->packed_nid) { + sbi->packed_inode =3D erofs_iget(sb, sbi->packed_nid); + if (IS_ERR(sbi->packed_inode)) { + err =3D PTR_ERR(sbi->packed_inode); + sbi->packed_inode =3D NULL; + return err; + } + } +#endif err =3D erofs_init_managed_cache(sb); if (err) return err; --=20 2.19.1.6.gb485710b From nobody Wed Feb 11 14:04:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10E6AC77B6C for ; Fri, 7 Apr 2023 14:17:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240562AbjDGORa (ORCPT ); Fri, 7 Apr 2023 10:17:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231715AbjDGORU (ORCPT ); Fri, 7 Apr 2023 10:17:20 -0400 Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05E016EB7 for ; Fri, 7 Apr 2023 07:17:18 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VfXA6.c_1680877034; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VfXA6.c_1680877034) by smtp.aliyun-inc.com; Fri, 07 Apr 2023 22:17:14 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 3/7] erofs: move packed inode out of the compression part Date: Fri, 7 Apr 2023 22:17:06 +0800 Message-Id: <20230407141710.113882-4-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20230407141710.113882-1-jefflexu@linux.alibaba.com> References: <20230407141710.113882-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" packed inode could be used in more scenarios which are independent of compression in the future. For example, packed inode could be used to keep extra long xattr prefixes with the help of following patches. Signed-off-by: Jingbo Xu Acked-by: Chao Yu Reviewed-by: Gao Xiang Reviewed-by: Yue Hu --- fs/erofs/internal.h | 2 +- fs/erofs/super.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index caea9dc1cd82..8b5168f94dd2 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -134,8 +134,8 @@ struct erofs_sb_info { struct inode *managed_cache; =20 struct erofs_sb_lz4_info lz4; - struct inode *packed_inode; #endif /* CONFIG_EROFS_FS_ZIP */ + struct inode *packed_inode; struct erofs_dev_context *devs; struct dax_device *dax_dev; u64 dax_part_off; diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 325602820dc8..8f2f8433db61 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -810,7 +810,6 @@ static int erofs_fc_fill_super(struct super_block *sb, = struct fs_context *fc) =20 erofs_shrinker_register(sb); /* sb->s_umount is already locked, SB_ACTIVE and SB_BORN are not set */ -#ifdef CONFIG_EROFS_FS_ZIP if (erofs_sb_has_fragments(sbi) && sbi->packed_nid) { sbi->packed_inode =3D erofs_iget(sb, sbi->packed_nid); if (IS_ERR(sbi->packed_inode)) { @@ -819,7 +818,6 @@ static int erofs_fc_fill_super(struct super_block *sb, = struct fs_context *fc) return err; } } -#endif err =3D erofs_init_managed_cache(sb); if (err) return err; @@ -986,9 +984,9 @@ static void erofs_put_super(struct super_block *sb) #ifdef CONFIG_EROFS_FS_ZIP iput(sbi->managed_cache); sbi->managed_cache =3D NULL; +#endif iput(sbi->packed_inode); sbi->packed_inode =3D NULL; -#endif erofs_free_dev_context(sbi->devs); sbi->devs =3D NULL; erofs_fscache_unregister_fs(sb); --=20 2.19.1.6.gb485710b From nobody Wed Feb 11 14:04:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CD9CC77B61 for ; Fri, 7 Apr 2023 14:17:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240663AbjDGORl (ORCPT ); Fri, 7 Apr 2023 10:17:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240066AbjDGORW (ORCPT ); Fri, 7 Apr 2023 10:17:22 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9B146EB5 for ; Fri, 7 Apr 2023 07:17:20 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VfX7DEZ_1680877035; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VfX7DEZ_1680877035) by smtp.aliyun-inc.com; Fri, 07 Apr 2023 22:17:15 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 4/7] erofs: introduce on-disk format for long xattr name prefixes Date: Fri, 7 Apr 2023 22:17:07 +0800 Message-Id: <20230407141710.113882-5-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20230407141710.113882-1-jefflexu@linux.alibaba.com> References: <20230407141710.113882-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Besides the predefined xattr name prefixes, introduces long xattr name prefixes, which work similarly as the predefined name prefixes, except that they are user specified. It is especially useful for use cases together with overlayfs like Composefs model, which introduces diverse xattr values with only a few common xattr names (trusted.overlay.redirect, trusted.overlay.digest, and maybe more in the future). That makes the existing predefined prefixes ineffective in both image size and runtime performance. When a user specified long xattr name prefix is used, only the trailing part of the xattr name apart from the long xattr name prefix will be stored in erofs_xattr_entry.e_name. e_name is empty if the xattr name matches exactly as the long xattr name prefix. All long xattr prefixes are stored in the packed or meta inode, which depends if fragments feature is enabled or not. For each long xattr name prefix, the on-disk format is kept as the same as the unique metadata format: ALIGN({__le16 len, data}, 4), where len represents the total size of struct erofs_xattr_long_prefix, followed by data of struct erofs_xattr_long_prefix itself. Each erofs_xattr_long_prefix keeps predefined prefixes (base_index) and the remaining prefix string without the trailing '\0'. Two fields are introduced to the on-disk superblock, where xattr_prefix_count represents the total number of the long xattr name prefixes recorded, and xattr_prefix_start represents the start offset of recorded name prefixes in the packed/meta inode divided by 4. When referring to a long xattr name prefix, the highest bit (bit 7) of erofs_xattr_entry.e_name_index is set, while the lower bits (bit 0-6) as a whole represents the index of the referred long name prefix among all long xattr name prefixes. Signed-off-by: Jingbo Xu Acked-by: Chao Yu Reviewed-by: Gao Xiang --- fs/erofs/erofs_fs.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/fs/erofs/erofs_fs.h b/fs/erofs/erofs_fs.h index 44876a97cabd..ea62f83dac40 100644 --- a/fs/erofs/erofs_fs.h +++ b/fs/erofs/erofs_fs.h @@ -76,7 +76,8 @@ struct erofs_super_block { __le16 extra_devices; /* # of devices besides the primary device */ __le16 devt_slotoff; /* startoff =3D devt_slotoff * devt_slotsize */ __u8 dirblkbits; /* directory block size in bit shift */ - __u8 reserved[5]; + __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]; }; @@ -229,6 +230,13 @@ struct erofs_xattr_ibody_header { #define EROFS_XATTR_INDEX_LUSTRE 5 #define EROFS_XATTR_INDEX_SECURITY 6 =20 +/* + * bit 7 of e_name_index is set when it refers to a long xattr name prefix, + * while the remained lower bits represent the index of the prefix. + */ +#define EROFS_XATTR_LONG_PREFIX 0x80 +#define EROFS_XATTR_LONG_PREFIX_MASK 0x7f + /* xattr entry (for both inline & shared xattrs) */ struct erofs_xattr_entry { __u8 e_name_len; /* length of name */ @@ -238,6 +246,12 @@ struct erofs_xattr_entry { char e_name[]; /* attribute name */ }; =20 +/* long xattr name prefix */ +struct erofs_xattr_long_prefix { + __u8 base_index; /* short xattr name prefix index */ + char infix[]; /* infix apart from short prefix */ +}; + static inline unsigned int erofs_xattr_ibody_size(__le16 i_xattr_icount) { if (!i_xattr_icount) --=20 2.19.1.6.gb485710b From nobody Wed Feb 11 14:04:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0039CC6FD1D for ; Fri, 7 Apr 2023 14:17:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240589AbjDGORd (ORCPT ); Fri, 7 Apr 2023 10:17:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239811AbjDGORW (ORCPT ); Fri, 7 Apr 2023 10:17:22 -0400 Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5DA66EB8 for ; Fri, 7 Apr 2023 07:17:19 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VfX7DF5_1680877036; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VfX7DF5_1680877036) by smtp.aliyun-inc.com; Fri, 07 Apr 2023 22:17:16 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 5/7] erofs: add helpers to load long xattr name prefixes Date: Fri, 7 Apr 2023 22:17:08 +0800 Message-Id: <20230407141710.113882-6-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20230407141710.113882-1-jefflexu@linux.alibaba.com> References: <20230407141710.113882-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Long xattr name prefixes will be scanned upon mounting and the in-memory long xattr name prefix array will be initialized accordingly. Signed-off-by: Jingbo Xu Acked-by: Chao Yu Reviewed-by: Gao Xiang --- fs/erofs/internal.h | 10 ++++++++ fs/erofs/super.c | 6 ++--- fs/erofs/xattr.c | 56 +++++++++++++++++++++++++++++++++++++++++++++ fs/erofs/xattr.h | 4 ++++ 4 files changed, 73 insertions(+), 3 deletions(-) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 8b5168f94dd2..5a9c19654b19 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -117,6 +117,11 @@ struct erofs_fscache { char *name; }; =20 +struct erofs_xattr_prefix_item { + struct erofs_xattr_long_prefix *prefix; + u8 infix_len; +}; + struct erofs_sb_info { struct erofs_mount_opts opt; /* options */ #ifdef CONFIG_EROFS_FS_ZIP @@ -145,6 +150,9 @@ struct erofs_sb_info { u32 meta_blkaddr; #ifdef CONFIG_EROFS_FS_XATTR u32 xattr_blkaddr; + u32 xattr_prefix_start; + u8 xattr_prefix_count; + struct erofs_xattr_prefix_item *xattr_prefixes; #endif u16 device_id_mask; /* valid bits of device id to be used */ =20 @@ -440,6 +448,8 @@ extern const struct iomap_ops z_erofs_iomap_report_ops; #define EROFS_REG_COOKIE_SHARE 0x0001 #define EROFS_REG_COOKIE_NEED_NOEXIST 0x0002 =20 +void *erofs_read_metadata(struct super_block *sb, struct erofs_buf *buf, + erofs_off_t *offset, int *lengthp); void erofs_unmap_metabuf(struct erofs_buf *buf); void erofs_put_metabuf(struct erofs_buf *buf); void *erofs_bread(struct erofs_buf *buf, erofs_blk_t blkaddr, diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 8f2f8433db61..bf396e0c243a 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -126,10 +126,9 @@ static bool check_layout_compatibility(struct super_bl= ock *sb, return true; } =20 -#ifdef CONFIG_EROFS_FS_ZIP /* read variable-sized metadata, offset will be aligned by 4-byte */ -static void *erofs_read_metadata(struct super_block *sb, struct erofs_buf = *buf, - erofs_off_t *offset, int *lengthp) +void *erofs_read_metadata(struct super_block *sb, struct erofs_buf *buf, + erofs_off_t *offset, int *lengthp) { u8 *buffer, *ptr; int len, i, cnt; @@ -162,6 +161,7 @@ static void *erofs_read_metadata(struct super_block *sb= , struct erofs_buf *buf, return buffer; } =20 +#ifdef CONFIG_EROFS_FS_ZIP static int erofs_load_compr_cfgs(struct super_block *sb, struct erofs_super_block *dsb) { diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c index d76b74ece2e5..684571e83a2c 100644 --- a/fs/erofs/xattr.c +++ b/fs/erofs/xattr.c @@ -610,6 +610,62 @@ ssize_t erofs_listxattr(struct dentry *dentry, return ret; } =20 +void erofs_xattr_prefixes_cleanup(struct super_block *sb) +{ + struct erofs_sb_info *sbi =3D EROFS_SB(sb); + int i; + + if (sbi->xattr_prefixes) { + for (i =3D 0; i < sbi->xattr_prefix_count; i++) + kfree(sbi->xattr_prefixes[i].prefix); + kfree(sbi->xattr_prefixes); + sbi->xattr_prefixes =3D NULL; + } +} + +int erofs_xattr_prefixes_init(struct super_block *sb) +{ + struct erofs_sb_info *sbi =3D EROFS_SB(sb); + struct erofs_buf buf =3D __EROFS_BUF_INITIALIZER; + erofs_off_t pos =3D (erofs_off_t)sbi->xattr_prefix_start << 2; + struct erofs_xattr_prefix_item *pfs; + int ret =3D 0, i, len; + + if (!sbi->xattr_prefix_count) + return 0; + + pfs =3D kzalloc(sbi->xattr_prefix_count * sizeof(*pfs), GFP_KERNEL); + if (!pfs) + return -ENOMEM; + + if (erofs_sb_has_fragments(sbi)) + buf.inode =3D sbi->packed_inode; + else + erofs_init_metabuf(&buf, sb); + + for (i =3D 0; i < sbi->xattr_prefix_count; i++) { + void *ptr =3D erofs_read_metadata(sb, &buf, &pos, &len); + + if (IS_ERR(ptr)) { + ret =3D PTR_ERR(ptr); + break; + } else if (len < sizeof(*pfs->prefix) || + len > EROFS_NAME_LEN + sizeof(*pfs->prefix)) { + kfree(ptr); + ret =3D -EFSCORRUPTED; + break; + } + pfs[i].prefix =3D ptr; + pfs[i].infix_len =3D len - sizeof(struct erofs_xattr_long_prefix); + } + + erofs_put_metabuf(&buf); + sbi->xattr_prefixes =3D pfs; + if (ret) + erofs_xattr_prefixes_cleanup(sb); + return ret; +} + #ifdef CONFIG_EROFS_FS_POSIX_ACL struct posix_acl *erofs_get_acl(struct inode *inode, int type, bool rcu) { diff --git a/fs/erofs/xattr.h b/fs/erofs/xattr.h index a65158cba14f..e1265351aedd 100644 --- a/fs/erofs/xattr.h +++ b/fs/erofs/xattr.h @@ -40,9 +40,13 @@ static inline const struct xattr_handler *erofs_xattr_ha= ndler(unsigned int idx) =20 extern const struct xattr_handler *erofs_xattr_handlers[]; =20 +int erofs_xattr_prefixes_init(struct super_block *sb); +void erofs_xattr_prefixes_cleanup(struct super_block *sb); int erofs_getxattr(struct inode *, int, const char *, void *, size_t); ssize_t erofs_listxattr(struct dentry *, char *, size_t); #else +static inline int erofs_xattr_prefixes_init(struct super_block *sb) { retu= rn 0; } +static inline void erofs_xattr_prefixes_cleanup(struct super_block *sb) {} static inline int erofs_getxattr(struct inode *inode, int index, const char *name, void *buffer, size_t buffer_size) --=20 2.19.1.6.gb485710b From nobody Wed Feb 11 14:04:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4EC2C77B6C for ; Fri, 7 Apr 2023 14:17:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240612AbjDGORf (ORCPT ); Fri, 7 Apr 2023 10:17:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240080AbjDGORW (ORCPT ); Fri, 7 Apr 2023 10:17:22 -0400 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 224BD72BC for ; Fri, 7 Apr 2023 07:17:20 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VfX8ext_1680877037; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VfX8ext_1680877037) by smtp.aliyun-inc.com; Fri, 07 Apr 2023 22:17:18 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 6/7] erofs: handle long xattr name prefixes properly Date: Fri, 7 Apr 2023 22:17:09 +0800 Message-Id: <20230407141710.113882-7-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20230407141710.113882-1-jefflexu@linux.alibaba.com> References: <20230407141710.113882-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Make .{list,get}xattr routines adapted to long xattr name prefixes. When the bit 7 of erofs_xattr_entry.e_name_index is set, it indicates that it refers to a long xattr name prefix. Signed-off-by: Jingbo Xu Acked-by: Chao Yu Reviewed-by: Gao Xiang --- fs/erofs/xattr.c | 60 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c index 684571e83a2c..8d81593655e8 100644 --- a/fs/erofs/xattr.c +++ b/fs/erofs/xattr.c @@ -301,11 +301,39 @@ struct getxattr_iter { struct qstr name; }; =20 +static int erofs_xattr_long_entrymatch(struct getxattr_iter *it, + struct erofs_xattr_entry *entry) +{ + struct erofs_sb_info *sbi =3D EROFS_SB(it->it.sb); + u8 idx =3D entry->e_name_index & EROFS_XATTR_LONG_PREFIX_MASK; + struct erofs_xattr_prefix_item *pf; + + if (idx >=3D sbi->xattr_prefix_count) + return -ENOATTR; + + pf =3D &sbi->xattr_prefixes[idx]; + if (it->index !=3D pf->prefix->base_index) + return -ENOATTR; + + if (strncmp(it->name.name, pf->prefix->infix, pf->infix_len)) + return -ENOATTR; + + it->name.name +=3D pf->infix_len; + it->name.len -=3D pf->infix_len; + if (it->name.len !=3D entry->e_name_len) + return -ENOATTR; + return 0; +} + static int xattr_entrymatch(struct xattr_iter *_it, struct erofs_xattr_entry *entry) { struct getxattr_iter *it =3D container_of(_it, struct getxattr_iter, it); =20 + /* should also match the infix for long name prefixes */ + if (entry->e_name_index & EROFS_XATTR_LONG_PREFIX) + return erofs_xattr_long_entrymatch(it, entry); + return (it->index !=3D entry->e_name_index || it->name.len !=3D entry->e_name_len) ? -ENOATTR : 0; } @@ -487,12 +515,26 @@ static int xattr_entrylist(struct xattr_iter *_it, { struct listxattr_iter *it =3D container_of(_it, struct listxattr_iter, it); - unsigned int prefix_len; - const char *prefix; - - const struct xattr_handler *h =3D - erofs_xattr_handler(entry->e_name_index); + unsigned int base_index =3D entry->e_name_index; + unsigned int prefix_len, infix_len =3D 0; + const char *prefix, *infix =3D NULL; + const struct xattr_handler *h; + + if (entry->e_name_index & EROFS_XATTR_LONG_PREFIX) { + struct erofs_sb_info *sbi =3D EROFS_SB(_it->sb); + u8 idx =3D entry->e_name_index & EROFS_XATTR_LONG_PREFIX_MASK; + struct erofs_xattr_prefix_item *pf; + + if (idx >=3D sbi->xattr_prefix_count) + return 1; + + pf =3D &sbi->xattr_prefixes[idx]; + infix =3D pf->prefix->infix; + infix_len =3D pf->infix_len; + base_index =3D pf->prefix->base_index; + } =20 + h =3D erofs_xattr_handler(base_index); if (!h || (h->list && !h->list(it->dentry))) return 1; =20 @@ -500,16 +542,18 @@ static int xattr_entrylist(struct xattr_iter *_it, prefix_len =3D strlen(prefix); =20 if (!it->buffer) { - it->buffer_ofs +=3D prefix_len + entry->e_name_len + 1; + it->buffer_ofs +=3D prefix_len + infix_len + + entry->e_name_len + 1; return 1; } =20 - if (it->buffer_ofs + prefix_len + if (it->buffer_ofs + prefix_len + infix_len + + entry->e_name_len + 1 > it->buffer_size) return -ERANGE; =20 memcpy(it->buffer + it->buffer_ofs, prefix, prefix_len); - it->buffer_ofs +=3D prefix_len; + memcpy(it->buffer + it->buffer_ofs + prefix_len, infix, infix_len); + it->buffer_ofs +=3D prefix_len + infix_len; return 0; } =20 --=20 2.19.1.6.gb485710b From nobody Wed Feb 11 14:04:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF62AC6FD1D for ; Fri, 7 Apr 2023 14:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230499AbjDGORi (ORCPT ); Fri, 7 Apr 2023 10:17:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240100AbjDGORW (ORCPT ); Fri, 7 Apr 2023 10:17:22 -0400 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADB9176AA for ; Fri, 7 Apr 2023 07:17:21 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R231e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VfX4iF._1680877038; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VfX4iF._1680877038) by smtp.aliyun-inc.com; Fri, 07 Apr 2023 22:17:19 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 7/7] erofs: enable long extended attribute name prefixes Date: Fri, 7 Apr 2023 22:17:10 +0800 Message-Id: <20230407141710.113882-8-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20230407141710.113882-1-jefflexu@linux.alibaba.com> References: <20230407141710.113882-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Acked-by: Chao Yu --- fs/erofs/erofs_fs.h | 4 +++- fs/erofs/internal.h | 1 + fs/erofs/super.c | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/fs/erofs/erofs_fs.h b/fs/erofs/erofs_fs.h index ea62f83dac40..ac42a7255b39 100644 --- a/fs/erofs/erofs_fs.h +++ b/fs/erofs/erofs_fs.h @@ -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 | \ @@ -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) =20 #define EROFS_SB_EXTSLOT_SIZE 16 =20 diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 5a9c19654b19..f675050af2bb 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -285,6 +285,7 @@ EROFS_FEATURE_FUNCS(compr_head2, incompat, INCOMPAT_COM= PR_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) =20 /* atomic flag definitions */ diff --git a/fs/erofs/super.c b/fs/erofs/super.c index bf396e0c243a..8f85cc6162e2 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -391,6 +391,9 @@ static int erofs_read_superblock(struct super_block *sb) sbi->packed_nid =3D le64_to_cpu(dsb->packed_nid); sbi->inos =3D le64_to_cpu(dsb->inos); =20 + sbi->xattr_prefix_start =3D le32_to_cpu(dsb->xattr_prefix_start); + sbi->xattr_prefix_count =3D dsb->xattr_prefix_count; + sbi->build_time =3D le64_to_cpu(dsb->build_time); sbi->build_time_nsec =3D le32_to_cpu(dsb->build_time_nsec); =20 @@ -822,6 +825,10 @@ static int erofs_fc_fill_super(struct super_block *sb,= struct fs_context *fc) if (err) return err; =20 + err =3D erofs_xattr_prefixes_init(sb); + if (err) + return err; + err =3D erofs_register_sysfs(sb); if (err) return err; @@ -981,6 +988,7 @@ static void erofs_put_super(struct super_block *sb) =20 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 =3D NULL; --=20 2.19.1.6.gb485710b