public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Hongbo Li <lihongbo22@huawei.com>
Cc: linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, Chao Yu <chao@kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	"Darrick J. Wong" <djwong@kernel.org>,
	Amir Goldstein <amir73il@gmail.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v10 05/10] erofs: support user-defined fingerprint name
Date: Tue, 23 Dec 2025 15:22:00 +0800	[thread overview]
Message-ID: <9f03647d-2996-4d16-8c64-5afecdc904a9@linux.alibaba.com> (raw)
In-Reply-To: <20251223015618.485626-6-lihongbo22@huawei.com>



On 2025/12/23 09:56, Hongbo Li wrote:
> From: Hongzhen Luo <hongzhen@linux.alibaba.com>
> 
> When creating the EROFS image, users can specify the fingerprint name.
> This is to prepare for the upcoming inode page cache share.
> 
> Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
> ---
>   fs/erofs/Kconfig    |  9 +++++++++
>   fs/erofs/erofs_fs.h |  5 +++--
>   fs/erofs/internal.h |  2 ++
>   fs/erofs/super.c    |  3 +++
>   fs/erofs/xattr.c    | 13 +++++++++++++
>   5 files changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/erofs/Kconfig b/fs/erofs/Kconfig
> index d81f3318417d..c88b6d0714a4 100644
> --- a/fs/erofs/Kconfig
> +++ b/fs/erofs/Kconfig
> @@ -194,3 +194,12 @@ config EROFS_FS_PCPU_KTHREAD_HIPRI
>   	  at higher priority.
>   
>   	  If unsure, say N.
> +
> +config EROFS_FS_PAGE_CACHE_SHARE
> +	bool "EROFS page cache share support (experimental)"
> +	depends on EROFS_FS && EROFS_FS_XATTR && !EROFS_FS_ONDEMAND
> +	help
> +	  This enables page cache sharing among inodes with identical
> +	  content fingerprints on the same device.

`on the same device` seems ambiguous because of `device`.

maybe just `on the same machine`.

> +
> +	  If unsure, say N.
> diff --git a/fs/erofs/erofs_fs.h b/fs/erofs/erofs_fs.h
> index e24268acdd62..20515d2462af 100644
> --- a/fs/erofs/erofs_fs.h
> +++ b/fs/erofs/erofs_fs.h
> @@ -17,7 +17,7 @@
>   #define EROFS_FEATURE_COMPAT_XATTR_FILTER		0x00000004
>   #define EROFS_FEATURE_COMPAT_SHARED_EA_IN_METABOX	0x00000008
>   #define EROFS_FEATURE_COMPAT_PLAIN_XATTR_PFX		0x00000010
> -
> +#define EROFS_FEATURE_COMPAT_ISHARE_XATTRS		0x00000020
>   
>   /*
>    * Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should
> @@ -83,7 +83,8 @@ struct erofs_super_block {
>   	__le32 xattr_prefix_start;	/* start of long xattr prefixes */
>   	__le64 packed_nid;	/* nid of the special packed inode */
>   	__u8 xattr_filter_reserved; /* reserved for xattr name filter */
> -	__u8 reserved[3];
> +	__u8 ishare_xattr_prefix_id;	/* indexes the ishare key in prefix xattres */
> +	__u8 reserved[2];
>   	__le32 build_time;	/* seconds added to epoch for mkfs time */
>   	__le64 rootnid_8b;	/* (48BIT on) nid of root directory */
>   	__le64 reserved2;
> diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
> index 98fe652aea33..99e2857173c3 100644
> --- a/fs/erofs/internal.h
> +++ b/fs/erofs/internal.h
> @@ -134,6 +134,7 @@ struct erofs_sb_info {
>   	u32 xattr_blkaddr;
>   	u32 xattr_prefix_start;
>   	u8 xattr_prefix_count;
> +	u8 ishare_xattr_pfx;
>   	struct erofs_xattr_prefix_item *xattr_prefixes;
>   	unsigned int xattr_filter_reserved;
>   #endif
> @@ -238,6 +239,7 @@ EROFS_FEATURE_FUNCS(sb_chksum, compat, COMPAT_SB_CHKSUM)
>   EROFS_FEATURE_FUNCS(xattr_filter, compat, COMPAT_XATTR_FILTER)
>   EROFS_FEATURE_FUNCS(shared_ea_in_metabox, compat, COMPAT_SHARED_EA_IN_METABOX)
>   EROFS_FEATURE_FUNCS(plain_xattr_pfx, compat, COMPAT_PLAIN_XATTR_PFX)
> +EROFS_FEATURE_FUNCS(ishare_xattrs, compat, COMPAT_ISHARE_XATTRS)
>   
>   static inline u64 erofs_nid_to_ino64(struct erofs_sb_info *sbi, erofs_nid_t nid)
>   {
> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> index 2a44c4e5af4f..68480f10e69d 100644
> --- a/fs/erofs/super.c
> +++ b/fs/erofs/super.c
> @@ -298,6 +298,9 @@ static int erofs_read_superblock(struct super_block *sb)
>   		if (ret)
>   			goto out;
>   	}
> +	if (erofs_sb_has_ishare_xattrs(sbi))
> +		sbi->ishare_xattr_pfx =
> +			dsb->ishare_xattr_prefix_id & EROFS_XATTR_LONG_PREFIX_MASK;

Is it possible to move this one into erofs_xattr_prefixes_init()?

we could pass dsb into erofs_xattr_prefixes_init() too.

>   
>   	ret = -EINVAL;
>   	sbi->feature_incompat = le32_to_cpu(dsb->feature_incompat);
> diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c
> index 396536d9a862..969e77efd038 100644
> --- a/fs/erofs/xattr.c
> +++ b/fs/erofs/xattr.c
> @@ -519,6 +519,19 @@ int erofs_xattr_prefixes_init(struct super_block *sb)
>   	}
>   
>   	erofs_put_metabuf(&buf);
> +	if (!ret && erofs_sb_has_ishare_xattrs(sbi)) {
> +		struct erofs_xattr_prefix_item *pf = pfs + sbi->ishare_xattr_pfx;
> +		struct erofs_xattr_long_prefix *newpfx;

then:
		sbi->ishare_xattr_pfx =
			dsb->ishare_xattr_prefix_id & EROFS_XATTR_LONG_PREFIX_MASK;
...

Thanks,
Gao Xiang

  reply	other threads:[~2025-12-23  7:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-23  1:56 [PATCH v10 00/10] erofs: Introduce page cache sharing feature Hongbo Li
2025-12-23  1:56 ` [PATCH v10 01/10] iomap: stash iomap read ctx in the private field of iomap_iter Hongbo Li
2025-12-23  2:32   ` Gao Xiang
2025-12-23  1:56 ` [PATCH v10 02/10] erofs: hold read context in iomap_iter if needed Hongbo Li
2025-12-23  2:32   ` Gao Xiang
2025-12-23  1:56 ` [PATCH v10 03/10] fs: Export alloc_empty_backing_file Hongbo Li
2025-12-23  8:31   ` Gao Xiang
2025-12-23 12:40     ` Amir Goldstein
2025-12-23  1:56 ` [PATCH v10 04/10] erofs: move `struct erofs_anon_fs_type` to super.c Hongbo Li
2025-12-23  8:30   ` Gao Xiang
2025-12-23  9:28     ` Hongbo Li
2025-12-23  1:56 ` [PATCH v10 05/10] erofs: support user-defined fingerprint name Hongbo Li
2025-12-23  7:22   ` Gao Xiang [this message]
2025-12-23  1:56 ` [PATCH v10 06/10] erofs: support domain-specific page cache share Hongbo Li
2025-12-23  7:25   ` Gao Xiang
2025-12-23  1:56 ` [PATCH v10 07/10] erofs: introduce the page cache share feature Hongbo Li
2025-12-23  8:11   ` Gao Xiang
2025-12-23  1:56 ` [PATCH v10 08/10] erofs: support unencoded inodes for page cache share Hongbo Li
2025-12-23  8:15   ` Gao Xiang
2025-12-23  8:34     ` Gao Xiang
2025-12-23  1:56 ` [PATCH v10 09/10] erofs: support compressed " Hongbo Li
2025-12-23  8:18   ` Gao Xiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f03647d-2996-4d16-8c64-5afecdc904a9@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=chao@kernel.org \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=lihongbo22@huawei.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox