From: Jia Zhu <zhujia.zj@bytedance.com> To: 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, jefflexu@linux.alibaba.com, huyue2@coolpad.com, Jia Zhu <zhujia.zj@bytedance.com> Subject: [PATCH V1 1/5] erofs: add 'domain_id' mount option for on-demand read sementics Date: Fri, 2 Sep 2022 11:47:44 +0800 [thread overview] Message-ID: <20220902034748.60868-2-zhujia.zj@bytedance.com> (raw) In-Reply-To: <20220902034748.60868-1-zhujia.zj@bytedance.com> 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> --- fs/erofs/internal.h | 1 + fs/erofs/super.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index cfee49d33b95..fe435d077f1a 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; }; struct erofs_dev_context { diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 3173debeaa5a..d01109069c6b 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; @@ -838,6 +851,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); } @@ -892,6 +906,7 @@ static void erofs_kill_sb(struct super_block *sb) erofs_fscache_unregister_cookie(&sbi->s_fscache); erofs_fscache_unregister_fs(sb); kfree(sbi->opt.fsid); + kfree(sbi->opt.domain_id); kfree(sbi); sb->s_fs_info = NULL; } @@ -1044,6 +1059,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; } -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Jia Zhu <zhujia.zj@bytedance.com> To: linux-erofs@lists.ozlabs.org, xiang@kernel.org, chao@kernel.org Cc: linux-kernel@vger.kernel.org, huyue2@coolpad.com, linux-fsdevel@vger.kernel.org, yinxin.x@bytedance.com Subject: [PATCH V1 1/5] erofs: add 'domain_id' mount option for on-demand read sementics Date: Fri, 2 Sep 2022 11:47:44 +0800 [thread overview] Message-ID: <20220902034748.60868-2-zhujia.zj@bytedance.com> (raw) In-Reply-To: <20220902034748.60868-1-zhujia.zj@bytedance.com> 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> --- fs/erofs/internal.h | 1 + fs/erofs/super.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index cfee49d33b95..fe435d077f1a 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; }; struct erofs_dev_context { diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 3173debeaa5a..d01109069c6b 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; @@ -838,6 +851,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); } @@ -892,6 +906,7 @@ static void erofs_kill_sb(struct super_block *sb) erofs_fscache_unregister_cookie(&sbi->s_fscache); erofs_fscache_unregister_fs(sb); kfree(sbi->opt.fsid); + kfree(sbi->opt.domain_id); kfree(sbi); sb->s_fs_info = NULL; } @@ -1044,6 +1059,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; } -- 2.20.1
next prev parent reply other threads:[~2022-09-02 3:48 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-02 3:47 [PATCH V1 0/5] Introduce erofs shared domain Jia Zhu 2022-09-02 3:47 ` Jia Zhu 2022-09-02 3:47 ` Jia Zhu [this message] 2022-09-02 3:47 ` [PATCH V1 1/5] erofs: add 'domain_id' mount option for on-demand read sementics Jia Zhu 2022-09-02 3:47 ` [PATCH V1 2/5] erofs: introduce fscache-based domain Jia Zhu 2022-09-02 3:47 ` Jia Zhu 2022-09-02 3:47 ` [PATCH V1 3/5] erofs: add 'domain_id' prefix when register sysfs Jia Zhu 2022-09-02 3:47 ` Jia Zhu 2022-09-02 3:47 ` [PATCH V1 4/5] erofs: remove duplicated unregister_cookie Jia Zhu 2022-09-02 3:47 ` Jia Zhu 2022-09-02 3:47 ` [PATCH V1 5/5] erofs: support fscache based shared domain Jia Zhu 2022-09-02 3:47 ` 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=20220902034748.60868-2-zhujia.zj@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.