Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp487259rwe; Wed, 31 Aug 2022 06:16:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR4r7H2on8e79cAo4xZwEVxwfG9Jz9vGi6mkFYHEItPOV7EV7r6Lm7welav/hs+61rqFGwQn X-Received: by 2002:a17:90b:3ec3:b0:1fa:a293:c511 with SMTP id rm3-20020a17090b3ec300b001faa293c511mr3345446pjb.156.1661951811154; Wed, 31 Aug 2022 06:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661951811; cv=none; d=google.com; s=arc-20160816; b=sCgdywvWErkxmCJkRcsk7uG7k+riz7ifC/h+EOC1drxyJSzkGaCPaZ152dwIjGx8Y0 +3UmA/qZjCZeTViujt2Mkwz1ySqKzqsYQ+9HAx8nEeX1DuquxiatgmDMHwQJ+mYbtNeT MdL0aO7h96QPbzah45aGFJsw5EXv3Sr1b7kSPeOKhTMamD2XqtTBbNtRUT8/MWPV6iys StibshXYvRwQRFdnnrcTtPWtKMp8E9oyNzCP1S9HjtPrs59HAgIZNQF5tmzuyEsTeyEp EhVpGBN3NlqFC+BJtXRl+7sF76IrAl1wQzoIKR+I8fP+KH//iF8aZ5XDUNNCjEuG7pvB jhzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Jk44PJvjdjdt0bhfpwnVqhAy54lOcNkatPLUifUkm78=; b=gB75b4HsbIYsrR+LR0Yvt7UxD0RQHq4J5HZ4ZGNN9VnyG2KapwHJV6aXM1BgCkh57x rSaWnNXP2IGx2muUSu6HQk5Ym/v3beUSPQxDZ7zHf1D4WB1eAJQDOi2pxbRAGoM1nCil ZWYDBu9CRrlAhMQwzgg3ETf6CiPtHR5tCSfr9k0yy6DmCNnLnBzH9L5x+/o9HPyhkfHt IQmGVhfxtLV3rCw2gdFFhuHhznAu5DBQDmD3FGhhzb19V5a/8RwXz+GbifLT3LSuz5jZ FAikfmvbmF3zmwS1kUTS4T2Yb+lO6Kd4Qcy9Xx3YkMihpzQ9+594safdZUDbxqgL3hOk 4pxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=a69A5kXx; 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 r9-20020a63d909000000b0041d16f4f04fsi4942820pgg.515.2022.08.31.06.16.39; Wed, 31 Aug 2022 06:16:51 -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=a69A5kXx; 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 S229720AbiHaMca (ORCPT + 99 others); Wed, 31 Aug 2022 08:32:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231224AbiHaMcY (ORCPT ); Wed, 31 Aug 2022 08:32:24 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98055D34FC for ; Wed, 31 Aug 2022 05:32:13 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id t5so14034651pjs.0 for ; Wed, 31 Aug 2022 05:32:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=Jk44PJvjdjdt0bhfpwnVqhAy54lOcNkatPLUifUkm78=; b=a69A5kXxCghZWvwb8YYV75Ozfttgowwd2GDPhnjFzjz+qEazPSR4vukwVjDh7QBPgG DsLfR21QtnFhVcOQEysq6Jco6goRw3OWeI6cA9DjxyCyRfdB2zDiWvyPyUcdLZ9EqD5M BvK5D6hByMcgaMRQh8s+I8VAX7SBzNISEkj7LjHvVxqShxdTkSOliOrFpfd66IHbD2IR j7w1+shnZDMc09iyr44+fiP6fribUX1dqpgfXPeZ1gkiFj2SsRf6i5ZcrElH/Ghz+Ehs v9WVDFy4uzKb1PAENyZNriVppdLqadwA31b+PFWbJtON6+TGleh3Evc+QEJhagIG1OpF X5AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Jk44PJvjdjdt0bhfpwnVqhAy54lOcNkatPLUifUkm78=; b=42PWTEWoq0X8Np1Xygi9xUOG2zTm5Z3FBdhnWiXpRKWKTgaLROWo+/W1W5nX0sMGfs c/rOTa0pm8wSOz/ZfmQxo9JPwAwSMwIFCmSz0CDha0qzHAlyZShVKZuMAlYs/TL3tFxB yASh032MYWFVvxFNEMdU9tcswbtZiy0HmagBtPNyXODOuRt5mvJa4JZOweHKen5FRJyG x1oexfP2Fb2S4PRqWwqzIsjUOqt8H+wtv8PyDuJK0nXFgW02TcRZN5kozUmd/l5M74/i YSkPhxnu+nLSf1IQ1ljxlhB3AX+0CsuAtzg3kKD7EuJ38UnQEHlWt8TXIER0p6X7otLm w5KA== X-Gm-Message-State: ACgBeo3DnA3lrrSd8tiS3vtyQKQUCTMiKiPNJBXgaaIPj/0RpwmkWE8r 8Km3i++qgo8djylPWWl/NCDgLw== X-Received: by 2002:a17:90b:35c3:b0:1fe:10c4:cfb7 with SMTP id nb3-20020a17090b35c300b001fe10c4cfb7mr3056865pjb.60.1661949132226; Wed, 31 Aug 2022 05:32:12 -0700 (PDT) Received: from C02G705SMD6V.bytedance.net ([61.120.150.76]) by smtp.gmail.com with ESMTPSA id n12-20020a170902e54c00b0016efad0a63csm11769896plf.100.2022.08.31.05.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 05:32:11 -0700 (PDT) From: Jia Zhu 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 Subject: [RFC PATCH 3/5] erofs: add 'domain_id' prefix when register sysfs Date: Wed, 31 Aug 2022 20:31:23 +0800 Message-Id: <20220831123125.68693-4-zhujia.zj@bytedance.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220831123125.68693-1-zhujia.zj@bytedance.com> References: <20220831123125.68693-1-zhujia.zj@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 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; + } 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); + kfree(name); if (err) goto put_sb_kobj; return 0; -- 2.20.1