From: Jia Zhu <zhujia.zj@bytedance.com>
To: JeffleXu <jefflexu@linux.alibaba.com>,
linux-erofs@lists.ozlabs.org, xiang@kernel.org, chao@kernel.org
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
yinxin.x@bytedance.com, huyue2@coolpad.com
Subject: Re: [External] Re: [PATCH V3 3/6] erofs: introduce 'domain_id' mount option
Date: Thu, 15 Sep 2022 15:43:48 +0800 [thread overview]
Message-ID: <dfebd3d3-29e6-b01e-a163-2ea0766062ae@bytedance.com> (raw)
In-Reply-To: <6644b9eb-d477-bbca-bbbe-b41776e38a46@linux.alibaba.com>
在 2022/9/15 15:30, JeffleXu 写道:
>
>
> On 9/14/22 6:50 PM, Jia Zhu wrote:
>> 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>
>
> Could you please move this patch to the end of this patch set, so that
> once the "domain_id" mount option is visible to users, this feature
> really works?
>
Thanks for your example. I'll revise it.
>
>> ---
>> fs/erofs/internal.h | 1 +
>> fs/erofs/super.c | 17 +++++++++++++++++
>> fs/erofs/sysfs.c | 19 +++++++++++++++++--
>> 3 files changed, 35 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
>> index aa71eb65e965..2d129c6b3027 100644
>> --- a/fs/erofs/internal.h
>> +++ b/fs/erofs/internal.h
>> @@ -76,6 +76,7 @@ struct erofs_mount_opts {
>> #endif
>> unsigned int mount_opt;
>> char *fsid;
>> + char *domain_id;
>> };
>
> Indeed we can add @domain_id field into struct erofs_mount_opts in prep
> for the following implementation of the domain_id feature. IOW, the
> above change can be folded into patch 4, just like what [1] does.
>
> [1]
> https://github.com/torvalds/linux/commit/c6be2bd0a5dd91f98d6b5d2df2c79bc32993352c#diff-eee5fb30f4e83505af808386e84c953266d2fd2e76b6e66cb94cf6e849881240R77
>
>
>>
>> struct erofs_dev_context {
>> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
>> index 7aa57dcebf31..856758ee4869 100644
>> --- a/fs/erofs/super.c
>> +++ b/fs/erofs/super.c
>> @@ -440,6 +440,7 @@ enum {
>> Opt_dax_enum,
>> Opt_device,
>> Opt_fsid,
>> + Opt_domain_id,
>> Opt_err
>> };
>>
>> @@ -465,6 +466,7 @@ static const struct fs_parameter_spec erofs_fs_parameters[] = {
>> fsparam_enum("dax", Opt_dax_enum, erofs_dax_param_enums),
>> fsparam_string("device", Opt_device),
>> fsparam_string("fsid", Opt_fsid),
>> + fsparam_string("domain_id", Opt_domain_id),
>> {}
>> };
>>
>> @@ -568,6 +570,16 @@ static int erofs_fc_parse_param(struct fs_context *fc,
>> return -ENOMEM;
>> #else
>> errorfc(fc, "fsid option not supported");
>> +#endif
>> + break;
>> + case Opt_domain_id:
>> +#ifdef CONFIG_EROFS_FS_ONDEMAND
>> + kfree(ctx->opt.domain_id);
>> + ctx->opt.domain_id = kstrdup(param->string, GFP_KERNEL);
>> + if (!ctx->opt.domain_id)
>> + return -ENOMEM;
>> +#else
>> + errorfc(fc, "domain_id option not supported");
>> #endif
>> break;
>> default:
>> @@ -695,6 +707,7 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
>> sb->s_fs_info = sbi;
>> sbi->opt = ctx->opt;
>> ctx->opt.fsid = NULL;
>> + ctx->opt.domain_id = NULL;
>> sbi->devs = ctx->devs;
>> ctx->devs = NULL;
>>
>> @@ -834,6 +847,7 @@ static void erofs_fc_free(struct fs_context *fc)
>>
>> erofs_free_dev_context(ctx->devs);
>> kfree(ctx->opt.fsid);
>> + kfree(ctx->opt.domain_id);
>> kfree(ctx);
>> }
>>
>> @@ -887,6 +901,7 @@ static void erofs_kill_sb(struct super_block *sb)
>> fs_put_dax(sbi->dax_dev, NULL);
>> erofs_fscache_unregister_fs(sb);
>> kfree(sbi->opt.fsid);
>> + kfree(sbi->opt.domain_id);
>> kfree(sbi);
>> sb->s_fs_info = NULL;
>> }
>> @@ -1040,6 +1055,8 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)
>> #ifdef CONFIG_EROFS_FS_ONDEMAND
>> if (opt->fsid)
>> seq_printf(seq, ",fsid=%s", opt->fsid);
>> + if (opt->domain_id)
>> + seq_printf(seq, ",domain_id=%s", opt->domain_id);
>> #endif
>> return 0;
>> }
>> 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;
>
next prev parent reply other threads:[~2022-09-15 7:44 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-14 10:50 [PATCH V3 0/6] Introduce erofs shared domain Jia Zhu
2022-09-14 10:50 ` [PATCH V3 1/6] erofs: use kill_anon_super() to kill super in fscache mode Jia Zhu
2022-09-15 2:28 ` JeffleXu
2022-09-15 6:07 ` [External] " Jia Zhu
2022-09-14 10:50 ` [PATCH V3 2/6] erofs: code clean up for fscache Jia Zhu
2022-09-15 2:26 ` JeffleXu
2022-09-15 6:45 ` JeffleXu
2022-09-14 10:50 ` [PATCH V3 3/6] erofs: introduce 'domain_id' mount option Jia Zhu
2022-09-15 7:30 ` JeffleXu
2022-09-15 7:43 ` Jia Zhu [this message]
2022-09-14 10:50 ` [PATCH V3 4/6] erofs: introduce fscache-based domain Jia Zhu
2022-09-14 13:21 ` Gao Xiang
2022-09-15 3:29 ` JeffleXu
2022-09-15 8:00 ` [External] " Jia Zhu
2022-09-15 3:27 ` JeffleXu
2022-09-14 10:50 ` [PATCH V3 5/6] erofs: introduce a pseudo mnt to manage shared cookies Jia Zhu
2022-09-15 5:43 ` JeffleXu
2022-09-14 10:50 ` [PATCH V3 6/6] erofs: Support sharing cookies in the same domain Jia Zhu
2022-09-14 13:30 ` Gao Xiang
2022-09-15 6:53 ` JeffleXu
2022-09-15 7:26 ` [External] " Jia Zhu
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=dfebd3d3-29e6-b01e-a163-2ea0766062ae@bytedance.com \
--to=zhujia.zj@bytedance.com \
--cc=chao@kernel.org \
--cc=huyue2@coolpad.com \
--cc=jefflexu@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiang@kernel.org \
--cc=yinxin.x@bytedance.com \
/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;
as well as URLs for NNTP newsgroup(s).