Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1787529rwe; Fri, 2 Sep 2022 04:00:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR5RKWnhSRoEb7+ajfOwZrDUx36AdffmnW6IRi4nDIxRUJj9Y54HuAkFJ1mK45UEmIMEVroC X-Received: by 2002:a17:906:c14f:b0:741:8829:6a97 with SMTP id dp15-20020a170906c14f00b0074188296a97mr17302150ejc.232.1662116431280; Fri, 02 Sep 2022 04:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662116431; cv=none; d=google.com; s=arc-20160816; b=oUA8leQEYUxJwqE/dz1sB7SnhgLTRuWy5q+s1BFtb1MRcJfpRRO6ZxE3FMcj+70jT/ 8IB/kn3+v2qCJ5hqUEld18i90O/Q7Vt9bAckbJzUKuPe6ZkoYdkncqbtUr2xLcglap8h FBDnUe4pGNafxCNBZmre+L8Wc91e67CZ7+wwuLXcES2xHu5FR1sz4PYCk1k0kuujdShm 58O0Upn8tU9MakGyxEdbEY6MO26tPo59X4+UdDsdxWrSXjYYQL46x6856/ru7DgrP19p 3dTEH9OMLCmk9GtY7r3fkRRQ3kc6CQvKDCSplevrb0iNHxoL2iKWgKrqA8Pw4gItSAQc 0rQA== 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=IaUwxl8LLBd9/4lf5A1yMCAhsBx5qY9hY0C5eVk/EaafwM4nITCIlOI8Cp+SP9EP/g HCA04N18Hc5IQVhQLASJeG08S9vG6yF03cuY7dl8XVBznZ/HXEcqfZmmB7t3kdQWihyO Mc46Kd6JXZ4UiyEjAWFNwiHUB0WZszw3sfmadx+E0PhxsVtdMjrSuqRf/mH8ME8GLcHh 4PA/vzRAPgFJsG0ncjBP4ah62PQ8zLeyXvcuaeO51KyUF11MhKJcjmtlLazVnwu1Ccs8 flhdIfUbekBfyHwLnEcN2bapaef4AgW3D5fuxZHP4KxE9MCeKFfNVTd3y3EhqrJSdRsv iPJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=KfcOYHlp; 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 dd15-20020a1709069b8f00b00741827c60aesi1856569ejc.592.2022.09.02.04.00.04; Fri, 02 Sep 2022 04:00:31 -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=KfcOYHlp; 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 S235990AbiIBKyl (ORCPT + 99 others); Fri, 2 Sep 2022 06:54:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235854AbiIBKyj (ORCPT ); Fri, 2 Sep 2022 06:54:39 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35C1EC9910 for ; Fri, 2 Sep 2022 03:54:22 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id u1-20020a17090a410100b001fff314d14fso1751257pjf.5 for ; Fri, 02 Sep 2022 03:54:22 -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:subject:date; bh=Jk44PJvjdjdt0bhfpwnVqhAy54lOcNkatPLUifUkm78=; b=KfcOYHlpWUeIQt9wkes3QakVS8YddcaWQ6Bp5getgWzzyA5QFGXOB01D4Byg8lDNNW QJg3+kZ6nXoSJBy2v3dhYD1T2kqsSGg5SQiljr0FiaoOuSKdsR7f/X1KTvjGyVHQ+bIC O7ISw/1864yQHYOFSpM7dVvue4o8mdxEbkQacl82pj3Ul7D7y2pAcmVL4dJcWuepptl3 0nGPQwcoFuiQ3GnBeI5ahRZjWWn2SLY8uhs3KHX/7rCbDGiR2l1kSFm+8or5p3kYoAGu /AHtra/ixW7Cx6Q/R6PZaQvT8b0cU3bezv/5Lkle8JRQb3GSnRLu1sZWWMxph6Jo3Yt5 1xdA== 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 :subject:date; bh=Jk44PJvjdjdt0bhfpwnVqhAy54lOcNkatPLUifUkm78=; b=ME3uwDVGglKlBOvRu6AujYyAhBMNtXgzdd+qiYLDRVxGzD0awe4UihASZmQe0HfSkc 2fs4O1fuItcLsBrm6sL2pUPzZUcy3tAg/3ifrx3H5hq0whebwbwPDCYQ3ZqyLh8dJxZK CTYKaExS7Foz54DdsO4J/uhE6Js3XUhDklNKVcNC6Uab7trNOJYNv4g9tQ/ILOApXpWE 4G+ial64PE+TAuMRRXexTaq2MQK/m8oTKPiUKediE43M4I4vIwNVrT6DEjWy4bOxUqFR v5CcF19hsPB6UCiB1+jwMgfVW5PIgHUeviBv0rvIQICuyEvDQNEPprMVA7vF2uaWfndR JvFw== X-Gm-Message-State: ACgBeo2Joj7xHhdPcpAItQEkEbv409chXpERR/rxFcHB7Y7W7lX4wers Fwc7+Wn2f57vOVMf39dVw2SDbg== X-Received: by 2002:a17:903:1106:b0:172:9801:cb96 with SMTP id n6-20020a170903110600b001729801cb96mr34926139plh.91.1662116061708; Fri, 02 Sep 2022 03:54:21 -0700 (PDT) Received: from C02G705SMD6V.bytedance.net ([61.120.150.76]) by smtp.gmail.com with ESMTPSA id e4-20020a63d944000000b0041b29fd0626sm1128681pgj.88.2022.09.02.03.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 03:54:21 -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: [PATCH V2 3/5] erofs: add 'domain_id' prefix when register sysfs Date: Fri, 2 Sep 2022 18:53:03 +0800 Message-Id: <20220902105305.79687-4-zhujia.zj@bytedance.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220902105305.79687-1-zhujia.zj@bytedance.com> References: <20220902105305.79687-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=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 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