From: Hongbo Li <lihongbo22@huawei.com>
To: Gao Xiang <hsiangkao@linux.alibaba.com>
Cc: <djwong@kernel.org>, <amir73il@gmail.com>, <hch@lst.de>,
<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>
Subject: Re: [PATCH v14 07/10] erofs: introduce the page cache share feature
Date: Thu, 15 Jan 2026 09:21:58 +0800 [thread overview]
Message-ID: <6ccc0f3f-56a5-4edb-a4c9-72d6e5090b7b@huawei.com> (raw)
In-Reply-To: <6defede0-2d2f-4193-8eb1-a1e1d842a8e3@linux.alibaba.com>
Hi,Xiang
On 2026/1/14 18:18, Gao Xiang wrote:
>
>
> On 2026/1/9 18:28, Hongbo Li wrote:
>> From: Hongzhen Luo <hongzhen@linux.alibaba.com>
>>
...
>> +
>> +static int erofs_ishare_iget5_set(struct inode *inode, void *data)
>> +{
>> + struct erofs_inode *vi = EROFS_I(inode);
>> +
>> + vi->fingerprint = *(struct erofs_inode_fingerprint *)data;
>> + INIT_LIST_HEAD(&vi->ishare_list);
>> + spin_lock_init(&vi->ishare_lock);
>> + return 0;
>> +}
>> +
>> +bool erofs_ishare_fill_inode(struct inode *inode)
>> +{
>> + struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb);
>> + struct erofs_inode *vi = EROFS_I(inode);
>> + struct erofs_inode_fingerprint fp;
>> + struct inode *sharedinode;
>> + unsigned long hash;
>> +
>> + if (erofs_xattr_fill_inode_fingerprint(&fp, inode, sbi->domain_id))
>> + return false;
>> + hash = xxh32(fp.opaque, fp.size, 0);
>> + sharedinode = iget5_locked(erofs_ishare_mnt->mnt_sb, hash,
>> + erofs_ishare_iget5_eq, erofs_ishare_iget5_set,
>> + &fp);
>> + if (!sharedinode) {
>> + kfree(fp.opaque);
>> + return false;
>> + }
>> +
>> + vi->sharedinode = sharedinode;
>> + if (inode_state_read_once(sharedinode) & I_NEW) {
>> + if (erofs_inode_is_data_compressed(vi->datalayout)) {
>> + sharedinode->i_mapping->a_ops = &z_erofs_aops;
>
> It seems that it caused a build warning:
> https://lore.kernel.org/r/202601130827.dHbGXL3Y-lkp@intel.com
>
>> + } else {
>> + sharedinode->i_mapping->a_ops = &erofs_aops;
>> +#ifdef CONFIG_EROFS_FS_BACKED_BY_FILE
>> + if (erofs_is_fileio_mode(sbi))
>> + sharedinode->i_mapping->a_ops = &erofs_fileio_aops;
>> +#endif
>> + }
>
> Can we introduce a new helper for those aops setting? such as:
>
> void erofs_inode_set_aops(struct erofs_inode *inode,
> struct erofs_inode *realinode, bool no_fscache)
Yeah, good idea. So it also can be reuse in erofs_fill_inode.
And how about declearing it as "int erofs_iode_set_aops(struct
erofs_inode *inode, struct erofs_inode *realinode, bool no_fscache)";
because the compressed case may return -EOPNOTSUPP and it seems we
cannot break this in advance. And can we mark it inline?
Thanks,
Hongbo
> {
> if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout)) {
> #ifdef CONFIG_EROFS_FS_ZIP
> DO_ONCE_LITE_IF(realinode->i_blkbits != PAGE_SHIFT,
> erofs_info, realinode->i_sb,
> "EXPERIMENTAL EROFS subpage compressed
> block support in use. Use at your own risk!");
> inode->i_mapping->a_ops = &z_erofs_aops;
> #else
> err = -EOPNOTSUPP;
> #endif
> } else {
> inode->i_mapping->a_ops = &erofs_aops;
> #ifdef CONFIG_EROFS_FS_ONDEMAND
> if (!nofscache && erofs_is_fscache_mode(realinode->i_sb))
> inode->i_mapping->a_ops =
> &erofs_fscache_access_aops;
> #endif
> #ifdef CONFIG_EROFS_FS_BACKED_BY_FILE
> if (erofs_is_fileio_mode(EROFS_SB(realinode->i_sb)))
> inode->i_mapping->a_ops = &erofs_fileio_aops;
> #endif
> }
> }
>
>
>
>> + sharedinode->i_mode = vi->vfs_inode.i_mode;
>> + sharedinode->i_size = vi->vfs_inode.i_size;
>> + unlock_new_inode(sharedinode);
>> + } else {
>> + kfree(fp.opaque);
>> + }
>> + INIT_LIST_HEAD(&vi->ishare_list);
>> + spin_lock(&EROFS_I(sharedinode)->ishare_lock);
>> + list_add(&vi->ishare_list, &EROFS_I(sharedinode)->ishare_list);
>> + spin_unlock(&EROFS_I(sharedinode)->ishare_lock);
>> + return true;
>> +}
>> +
>> +void erofs_ishare_free_inode(struct inode *inode)
>> +{
>> + struct erofs_inode *vi = EROFS_I(inode);
>> + struct inode *sharedinode = vi->sharedinode;
>> +
>> + if (!sharedinode)
>> + return;
>> + spin_lock(&EROFS_I(sharedinode)->ishare_lock);
>> + list_del(&vi->ishare_list);
>> + spin_unlock(&EROFS_I(sharedinode)->ishare_lock);
>> + iput(sharedinode);
>> + vi->sharedinode = NULL;
>> +}
>> +
...
>> /*
>> @@ -719,6 +733,10 @@ static int erofs_fc_fill_super(struct super_block
>> *sb, struct fs_context *fc)
>> erofs_info(sb, "unsupported blocksize for DAX");
>> clear_opt(&sbi->opt, DAX_ALWAYS);
>> }
>> + if (test_opt(&sbi->opt, INODE_SHARE) &&
>> !erofs_sb_has_ishare_xattrs(sbi)) {
>> + erofs_info(sb, "on-disk ishare xattrs not found. Turning off
>> inode_share.");
>> + clear_opt(&sbi->opt, INODE_SHARE);
>> + }
>
> It would be better to add a message like:
>
> if (test_opt(&sbi->opt, INODE_SHARE))
> erofs_info(sb, "EXPERIMENTAL EROFS page cache share support in
> use. Use at your own risk!");
>
> At the end of erofs_read_superblock().
>
Ok, I will add in next version.
Thanks,
Hongbo
> Thanks,
> Gao Xiang
next prev parent reply other threads:[~2026-01-15 1:22 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-09 10:28 [PATCH v14 00/10] erofs: Introduce page cache sharing feature Hongbo Li
2026-01-09 10:28 ` [PATCH v14 01/10] iomap: stash iomap read ctx in the private field of iomap_iter Hongbo Li
2026-01-09 18:14 ` Darrick J. Wong
2026-01-10 11:55 ` Gao Xiang
2026-01-09 10:28 ` [PATCH v14 02/10] erofs: hold read context in iomap_iter if needed Hongbo Li
2026-01-09 10:28 ` [PATCH v14 03/10] fs: Export alloc_empty_backing_file Hongbo Li
2026-01-12 9:10 ` Christian Brauner
2026-01-09 10:28 ` [PATCH v14 04/10] erofs: decouple `struct erofs_anon_fs_type` Hongbo Li
2026-01-09 10:28 ` [PATCH v14 05/10] erofs: support user-defined fingerprint name Hongbo Li
2026-01-09 10:28 ` [PATCH v14 06/10] erofs: support domain-specific page cache share Hongbo Li
2026-01-09 10:28 ` [PATCH v14 07/10] erofs: introduce the page cache share feature Hongbo Li
2026-01-14 10:18 ` Gao Xiang
2026-01-15 1:21 ` Hongbo Li [this message]
2026-01-15 1:43 ` Gao Xiang
2026-01-09 10:28 ` [PATCH v14 08/10] erofs: support unencoded inodes for page cache share Hongbo Li
2026-01-14 14:51 ` Gao Xiang
2026-01-15 1:36 ` Hongbo Li
2026-01-15 1:46 ` Gao Xiang
2026-01-15 1:47 ` Hongbo Li
2026-01-09 10:28 ` [PATCH v14 09/10] erofs: support compressed " Hongbo Li
2026-01-14 14:53 ` Gao Xiang
2026-01-09 10:28 ` [PATCH v14 10/10] erofs: implement .fadvise " Hongbo Li
2026-01-12 9:14 ` [PATCH v14 00/10] erofs: Introduce page cache sharing feature Christian Brauner
2026-01-12 14:40 ` Gao Xiang
2026-01-14 10:28 ` Gao Xiang
2026-01-14 15:34 ` Christian Brauner
2026-01-14 15:33 ` (subset) " Christian Brauner
2026-01-14 15:35 ` Christian Brauner
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=6ccc0f3f-56a5-4edb-a4c9-72d6e5090b7b@huawei.com \
--to=lihongbo22@huawei.com \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=chao@kernel.org \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=hsiangkao@linux.alibaba.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
all inboxes | Powered by JetHome®