Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp505589rwn; Thu, 15 Sep 2022 02:03:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR4pSOB1tcAUJORcPZBAmjGK8P8CYZ8BmDG5s7jx8Lp0xpi3Auy2+5xkiqVM7IR0mLLTXUif X-Received: by 2002:a17:90b:38c3:b0:202:e388:44bb with SMTP id nn3-20020a17090b38c300b00202e38844bbmr9765164pjb.44.1663232583087; Thu, 15 Sep 2022 02:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663232583; cv=none; d=google.com; s=arc-20160816; b=E1wtGfLgFd1/BR/BX65mgPiyv2gQPicFi+vP2GLEfsNIkX9lY9EYknir32vfDfhirw 0k2/+2AR587hy1FwpMlSF9wnE1jCgzMkWSq5Hb03zecxhoA7DIR3OAoMNMVhcRgpzNR4 Xbo996DbIsCfgTIJs9G+R2V+zC2Ni+0sJsFTMDO6RZnUDjLO4Qba7n7Z7FSH3KrVbC8O DKwes12F0hS5GpZcDftmYOnuy8fxqD7iZiVRN/kvilN9SJ6vkEtJFlBIi83XPGbFRv6p ZClATAqj81qHOotwvIE7QgCvy0UBUXeJWEegEX3uMPLMjnyKrlGi5Fe36m35cYiwwqbn oetw== 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:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=0aDjag9mgnZUwZDL3/dmCWrXaKWe2fIwx4al3A3NRMo=; b=oZ4z1oEjr5yLssCti88Uw9SBCZpzOr8WyahJ0eqH6kGtNo0+lx2S6/JqxVDpJIN4mS Md5QG4JxMjRI+/2q8+t9qeu5uVqZs8KYKJhgnIcwcl0YoD2kBCkZZAWA6wCVA3pFaKac wOznJZFvLb8VnChXkPZ5rbZ2+boSsz0Q+hx+Tk5UOoy2zgEQquxFKM1KTZMWweTc6dAY VZuU/7j4ov/67ALc1mtq1yh6mUam5Tn7uVpT58iaeknPwWpbuyuNt23QRkgMeMnfiVeb zPwFh9hw90XiEh7G8hmnNtGGyAJUK1RBB8GG2SGhEpjW2aAYoKzQpwPukEhUzbh+4hVl zzCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=oyz638cJ; 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=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e7-20020a17090a684700b002028a60c889si16071279pjm.100.2022.09.15.02.02.51; Thu, 15 Sep 2022 02:03:03 -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; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=oyz638cJ; 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=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229789AbiIOHoN (ORCPT + 99 others); Thu, 15 Sep 2022 03:44:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230088AbiIOHoI (ORCPT ); Thu, 15 Sep 2022 03:44:08 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 938A49412C for ; Thu, 15 Sep 2022 00:43:55 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id ge9so5412333pjb.1 for ; Thu, 15 Sep 2022 00:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date; bh=0aDjag9mgnZUwZDL3/dmCWrXaKWe2fIwx4al3A3NRMo=; b=oyz638cJKv6J2roLzQ7KUUqYcsktC7gk6sSK61//s+wfmM89JEHwWAFFzoyA9msFCh 44J2ixTroDwnDnlQpQJFyyVd7oQ1sWmMiAjPIoVqCn2RNA9YCAOpnywWqYFXfHluDIE6 7AvXNfldrSe9Si+E+wK6AwTI8CwdoR1ErcLG7iueucws0kOlmCc8HbjIFumwevGGDRLO v8fFYS70WGHt93NMrzi8r7zgJxcGHGeb/Hfk3rdn5fyWB4hehZKAYx2TeZDEghunP9Ys hgdZhXirIgAPO6X3Bue/aRm5tncCxy4BwS+Vqvkj7WTboJS5Y/LM4kPdRCdJucOX6j4a UzwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date; bh=0aDjag9mgnZUwZDL3/dmCWrXaKWe2fIwx4al3A3NRMo=; b=6E+JnhCXH3Ef+LREQVgjjh1LYvy4Y12srE1la8tprSgP23E83iP2xf7WtjsVuheEhP lpRFxF0vCh+OtJ4hYf4mNqo7/bxZqN3dca4oZGAYfcLF+z445GmeUDn5FfTub/9KWa/u Wd3tqhnxgcROxniqip7fQ0a5lhOFZK2xtQKwVgrw5m35QGFgs0aXkbjf5bzo6azH11Y7 Of/O5pQ7r1Aoul1GBTrXhVe0x1BB9KHmEGUeCD1gc7WdB4K2THYa/uYTTB2rUTxmcyoO 7LLzXtKUGih6tQidW7mFkiW4KokZsm42//k0jbP4TDeZrWZLhFbnP7TMlElIL4NQn/l3 KdUA== X-Gm-Message-State: ACrzQf0WaEPhsFRRTk8PaiiFcj5KQ3Gu5OKkT0JRohWLKudjbqj1aKXj ECxKmilS9ISwZwuD8PbQa+zVXQ== X-Received: by 2002:a17:902:d482:b0:178:1585:40b6 with SMTP id c2-20020a170902d48200b00178158540b6mr3092415plg.134.1663227834350; Thu, 15 Sep 2022 00:43:54 -0700 (PDT) Received: from [10.76.37.214] ([61.120.150.76]) by smtp.gmail.com with ESMTPSA id q17-20020a170902f35100b00172b87d9770sm12008735ple.81.2022.09.15.00.43.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Sep 2022 00:43:53 -0700 (PDT) Message-ID: Date: Thu, 15 Sep 2022 15:43:48 +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: [External] Re: [PATCH V3 3/6] erofs: introduce 'domain_id' mount option To: JeffleXu , 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> <6644b9eb-d477-bbca-bbbe-b41776e38a46@linux.alibaba.com> From: Jia Zhu In-Reply-To: <6644b9eb-d477-bbca-bbbe-b41776e38a46@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 在 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 > > 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; >