Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1700785rwn; Fri, 9 Sep 2022 02:41:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR5ZxBIBNIxdPQTg2PlRf/cfkMVcjHuiAVNY2D6dwVo9yENKOuk9mOz+QZesCgODygGrE38v X-Received: by 2002:a17:902:6b4c:b0:171:38ab:e762 with SMTP id g12-20020a1709026b4c00b0017138abe762mr12770396plt.42.1662716517068; Fri, 09 Sep 2022 02:41:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662716517; cv=none; d=google.com; s=arc-20160816; b=IzTvIwdNFoTlTvBgg97oEFbg++EwoAqVgcVyL5k5BSFZRCdDEufRHB8nMMZZfKDx// fb0zZuhwaT7OQA7B9iq3GcxNp5U5cjuThwshnWgvYRJzTwORRvwKDBKDgGqGZTuAU2gX 5Cxxm+neCjQZ3YGAzM4qvMN5xnS8iqGT+fviyRzEf8RTgkiK+0mw5NRBBng0kQyaEVTx CLmQegXfctV/QdEKrtlASrzaY2dapUtY0aC3r9gi7JQhr05KrgEvTO0W5v2Vd3h+GW6/ ibFfrbnq2w7q2vKXvpdt7KQmR+LGqJuOWgvJFaQLUd/be2kPMWAFYfSlS4bMokJHFjnL cizA== 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=fFzhjqAnRblGlsBR4ZeUFrr5v0zr/7sv0qb4nuuDaV8=; b=XSt5DG6jF4jlxzAafmyuoRQSuh+2tvs29CBbcVZTWFj1AY7aTwZtDN8x75LWyo6GYg gpczrZHC3AYyRn8BEgHYer2SQBNAGZcR2a777NL1LT8DXC3Q9l1ZXwYrIjP+3sdj8TAp w4TFT4V5LOP2aJiCenNWKYOWu+zwwq+LvEdgSlpqUNbB+l8P/DL73sCer7rEOv0zQxQB +v9qg8g3kYUA2Iwc642DhmD3cAvG22u+rD/ianoc+y1H3zDl+Kwa6MDeUZX1EFhKs6TD 6C4OhmOESre90iNI590jNOI/w7J4Qk5q8DCjsbc07TW0Pu58hNKvtCb/lG7ucae1yDYK /JXQ== 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 d14-20020a170902cece00b001768b6fc6cbsi70529plg.269.2022.09.09.02.41.45; Fri, 09 Sep 2022 02:41:57 -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 S230525AbiIIJZg (ORCPT + 99 others); Fri, 9 Sep 2022 05:25:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230337AbiIIJZN (ORCPT ); Fri, 9 Sep 2022 05:25:13 -0400 Received: from out199-8.us.a.mail.aliyun.com (out199-8.us.a.mail.aliyun.com [47.90.199.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCC8C136CF1; Fri, 9 Sep 2022 02:23:50 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R591e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VP8vBtl_1662715392; Received: from 30.221.130.74(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VP8vBtl_1662715392) by smtp.aliyun-inc.com; Fri, 09 Sep 2022 17:23:14 +0800 Message-ID: <539dcc26-a250-5bf4-0f3c-a3f7cdc2ce48@linux.alibaba.com> Date: Fri, 9 Sep 2022 17:23:12 +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 V2 3/5] erofs: add 'domain_id' prefix when register sysfs 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: <20220902105305.79687-1-zhujia.zj@bytedance.com> <20220902105305.79687-4-zhujia.zj@bytedance.com> From: JeffleXu In-Reply-To: <20220902105305.79687-4-zhujia.zj@bytedance.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,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/2/22 6:53 PM, Jia Zhu wrote: > In shared domain mount procedure, add 'domain_id' prefix to register > sysfs entry. Thus we could distinguish mounts that don't use shared > domain. > > Signed-off-by: Jia Zhu > --- > fs/erofs/sysfs.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c > index c1383e508bbe..c0031d7bd817 100644 > --- a/fs/erofs/sysfs.c > +++ b/fs/erofs/sysfs.c > @@ -201,12 +201,21 @@ static struct kobject erofs_feat = { > int erofs_register_sysfs(struct super_block *sb) > { > struct erofs_sb_info *sbi = EROFS_SB(sb); > + char *name = NULL; > int err; > > + if (erofs_is_fscache_mode(sb)) { > + name = kasprintf(GFP_KERNEL, "%s%s%s", sbi->opt.domain_id ? > + sbi->opt.domain_id : "", sbi->opt.domain_id ? "," : "", > + sbi->opt.fsid); > + if (!name) > + return -ENOMEM; > + } How about: name = erofs_is_fscache_mode(sb) ? sbi->opt.fsid : sb->s_id; if (sbi->opt.domain_id) { str = kasprintf(GFP_KERNEL, "%s,%s", sbi->opt.domain_id, sbi->opt.fsid); name = str; } > 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); > + name ? name : sb->s_id); kobject_init_and_add(..., "%s", name); kfree(str); though it's still not such straightforward... Any better idea? > + kfree(name); > if (err) > goto put_sb_kobj; > return 0; -- Thanks, Jingbo