[PATCH v12 07/10] erofs: introduce the page cache share feature

Gao Xiang hsiangkao at linux.alibaba.com
Wed Jan 7 18:27:23 AEDT 2026



On 2026/1/7 15:17, Hongbo Li wrote:
> Hi, Xiang
> 

...

>>>>> +
>>>>> +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 (!test_opt(&sbi->opt, INODE_SHARE))
>>>>> +        return false;
>>>>> +    (void)erofs_xattr_fill_ishare_fp(&fp, inode, sbi->domain_id);
>>>>> +    if (!fp.size)
>>>>> +        return false;
>>>>
>>>> Why not just:
>>>>
>>>>      if (erofs_xattr_fill_ishare_fp(&fp, inode, sbi->domain_id))
>>>>          return false;
>>>>
>>>
>>> When erofs_sb_has_ishare_xattrs returns false, erofs_xattr_fill_ishare_fp also considers success.
>>
>> Then why !test_opt(&sbi->opt, INODE_SHARE) didn't return?
>>
> 
> The MOUNT_INODE_SHARE flag is passed from user's mount option. And it is controllered by CONFIG_EROFS_FS_PAGE_CACHE_SHARE. I doesn't do the check when the superblock without ishare_xattrs. (It seems the mount options is static, although it is useless for mounting with inode_share on one EROFS image without ishare_xattrs).
> So should we check that if the superblock has not ishare_xattrs feature, and we return -ENOSUPP?

I think you should just mask off the INODE_SHARE if the on-disk
compat feature is unavailable, and print a warning just like
FSDAX fallback.

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list