[RFC PATCH v6 3/7] erofs: support domain-specific page cache share

Hongbo Li lihongbo22 at huawei.com
Sat Mar 22 12:22:43 AEDT 2025



On 2025/3/1 22:49, Hongzhen Luo wrote:
> Only files in the same domain will share the page cache. Also modify
> the sysfs related content in preparation for the upcoming page cache
> share feature.
> 
> Signed-off-by: Hongzhen Luo <hongzhen at linux.alibaba.com>
> ---
>   fs/erofs/super.c | 12 ++++++++----
>   1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> index 6af02cc8b8c6..ceab0c29b061 100644
> --- a/fs/erofs/super.c
> +++ b/fs/erofs/super.c
> @@ -489,6 +489,8 @@ static int erofs_fc_parse_param(struct fs_context *fc,
>   		if (!sbi->fsid)
>   			return -ENOMEM;
>   		break;
> +#endif
> +#if defined(CONFIG_EROFS_FS_ONDEMAND) || defined(CONFIG_EROFS_FS_INODE_SHARE)
>   	case Opt_domain_id:
>   		kfree(sbi->domain_id);
>   		sbi->domain_id = kstrdup(param->string, GFP_KERNEL);
> @@ -558,16 +560,16 @@ static void erofs_set_sysfs_name(struct super_block *sb)
>   {
>   	struct erofs_sb_info *sbi = EROFS_SB(sb);
>   
> -	if (sbi->domain_id)
> +	if (sbi->domain_id && !sbi->ishare_key)
>   		super_set_sysfs_name_generic(sb, "%s,%s", sbi->domain_id,
>   					     sbi->fsid);
>   	else if (sbi->fsid)
>   		super_set_sysfs_name_generic(sb, "%s", sbi->fsid);
> -	else if (erofs_is_fileio_mode(sbi))
I think there is no need to change this, because the inode page cache is 
just a mode for reading, not like a super block type.
> +	else if (!sb->s_bdi || !sb->s_bdi->dev)
> +		super_set_sysfs_name_id(sb);
> +	else
>   		super_set_sysfs_name_generic(sb, "%s",
>   					     bdi_dev_name(sb->s_bdi));
> -	else
> -		super_set_sysfs_name_id(sb);
>   }
>   
>   static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
> @@ -965,6 +967,8 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)
>   #ifdef CONFIG_EROFS_FS_ONDEMAND
>   	if (sbi->fsid)
>   		seq_printf(seq, ",fsid=%s", sbi->fsid);
> +#endif
> +#if defined(CONFIG_EROFS_FS_ONDEMAND) || defined(CONFIG_EROFS_FS_INODE_SHARE)
>   	if (sbi->domain_id)
>   		seq_printf(seq, ",domain_id=%s", sbi->domain_id);
>   #endif


More information about the Linux-erofs mailing list