summaryrefslogtreecommitdiff
path: root/fs/erofs/sysfs.c
diff options
context:
space:
mode:
authorJia Zhu <zhujia.zj@bytedance.com>2022-09-18 07:34:56 +0300
committerGao Xiang <hsiangkao@linux.alibaba.com>2022-09-20 03:01:54 +0300
commit2ef164414123fcf574aff7a0be5f71f7e60a3fec (patch)
treeaefc6bba528e9dfa4f8e9f47103b4fd8ff78b83e /fs/erofs/sysfs.c
parent7d41963759feb3cfa4c1164b8b9db5d1f055932d (diff)
downloadlinux-2ef164414123fcf574aff7a0be5f71f7e60a3fec.tar.xz
erofs: introduce 'domain_id' mount option
Introduce 'domain_id' mount option to enable shared domain sementics. In which case, the related cookie is shared if two mountpoints in the same domain have the same data blob. Users could specify the name of domain by this mount option. Signed-off-by: Jia Zhu <zhujia.zj@bytedance.com> Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com> Link: https://lore.kernel.org/r/20220918043456.147-7-zhujia.zj@bytedance.com Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Diffstat (limited to 'fs/erofs/sysfs.c')
-rw-r--r--fs/erofs/sysfs.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
index c1383e508bbe..341fb43ad587 100644
--- a/fs/erofs/sysfs.c
+++ b/fs/erofs/sysfs.c
@@ -201,12 +201,27 @@ static struct kobject erofs_feat = {
int erofs_register_sysfs(struct super_block *sb)
{
struct erofs_sb_info *sbi = EROFS_SB(sb);
+ char *name;
+ char *str = NULL;
int err;
+ if (erofs_is_fscache_mode(sb)) {
+ if (sbi->opt.domain_id) {
+ str = kasprintf(GFP_KERNEL, "%s,%s", sbi->opt.domain_id,
+ sbi->opt.fsid);
+ if (!str)
+ return -ENOMEM;
+ name = str;
+ } else {
+ name = sbi->opt.fsid;
+ }
+ } else {
+ name = sb->s_id;
+ }
sbi->s_kobj.kset = &erofs_root;
init_completion(&sbi->s_kobj_unregister);
- err = kobject_init_and_add(&sbi->s_kobj, &erofs_sb_ktype, NULL, "%s",
- erofs_is_fscache_mode(sb) ? sbi->opt.fsid : sb->s_id);
+ err = kobject_init_and_add(&sbi->s_kobj, &erofs_sb_ktype, NULL, "%s", name);
+ kfree(str);
if (err)
goto put_sb_kobj;
return 0;