Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp490343rwn; Thu, 15 Sep 2022 01:44:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR6DoMkI+It1NVE2qRr5eBj/xk+Ti4u5waSPiO6WabebH40AUXczjH8ou3RcqzXIBfN1NvnE X-Received: by 2002:a17:907:78d:b0:740:33e1:998 with SMTP id xd13-20020a170907078d00b0074033e10998mr28807463ejb.162.1663231444010; Thu, 15 Sep 2022 01:44:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663231444; cv=none; d=google.com; s=arc-20160816; b=cHLZ0BjIn2lf2WXyBWxVSVcTbJyoIQX+/Fse90EEPcYciHrofP4JgQXTb8alKQEsuM J+eNjzSULzZWmjFipgvbpNo2xOD3nw8oJJgdAW6GKUOMs1Pz2m1Bsa9nPR314jcMj9Cl sB1tGBL5PSlb/AnYR8/BBlXAsqSYMDEI41flyVeFLsSdkjcjnll5aNKgHcdFK9g3Zeng x2AQiGF7c4GyKMwLc34eQoWn8E/r9EhSN07cM4s1LOgNZwVuwEZWGwFaS2v/bLzbh84q eqRi8aYr6Olg2adGpQm/K+QMl9EzfW9ni1FUdWPkFC7LKmJXKG8G3uzYsQcSBOvYYztQ aGpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=8ICS7oBG+LDrdQMwGvN+1AN673LFQeTZC9TUc4MKRXA=; b=LeQXWWPFhz3hoQb0tfRy25LUwvOb0ZL5e/Q3f6mn5hFKZv4tUHd2+I3Mo5KYHmGm1q yfrJiP5Q9VSSyw9vkF418H0t5GMA+d87zSxQ4gQ0VwOMhbTVM8f5EqiBsT5LIyp5Axjw I433p1hxTgn8Xwbl4vTbXzH04C1DDFhb5a8GpBxY4HWtTM+JnutrlDZcLJPmjsfc3KnF DZ00l/UDSAz7UMSxo8iNfb2NNrON4C3Jy50ILj1jBwy5+YGSV6xTQquq04d6XT5iIboU zS3kMxsA/Y5tZ37RIY+ZBZV6aweHkk/MrTYeQU6PGcDO+BMNVf55mo5IBcPuwE6ZL7iG J36A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd21-20020a170907629500b0074b26b6bbbcsi14610129ejc.419.2022.09.15.01.43.37; Thu, 15 Sep 2022 01:44:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229732AbiIOHbL (ORCPT + 99 others); Thu, 15 Sep 2022 03:31:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbiIOHar (ORCPT ); Thu, 15 Sep 2022 03:30:47 -0400 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64F3690C6A; Thu, 15 Sep 2022 00:30:22 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VProXZo_1663227017; Received: from 30.221.129.91(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VProXZo_1663227017) by smtp.aliyun-inc.com; Thu, 15 Sep 2022 15:30:18 +0800 Message-ID: <6644b9eb-d477-bbca-bbbe-b41776e38a46@linux.alibaba.com> Date: Thu, 15 Sep 2022 15:30:17 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH V3 3/6] erofs: introduce 'domain_id' mount option Content-Language: en-US To: Jia Zhu , 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 References: <20220914105041.42970-1-zhujia.zj@bytedance.com> <20220914105041.42970-4-zhujia.zj@bytedance.com> From: JeffleXu In-Reply-To: <20220914105041.42970-4-zhujia.zj@bytedance.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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? > --- > 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; -- Thanks, Jingbo