Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1008619rwb; Sat, 17 Sep 2022 21:36:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4soTFjDpKdj3Ev/CCIA+oul5qA0OcTwferfR3DD8zntrKjrITBoDiKBAJ12FQmFMnxBkDA X-Received: by 2002:a05:6a00:26d1:b0:53e:1d86:bead with SMTP id p17-20020a056a0026d100b0053e1d86beadmr13017625pfw.26.1663475794958; Sat, 17 Sep 2022 21:36:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663475794; cv=none; d=google.com; s=arc-20160816; b=pRjAg9qw4FL6sqzPmbOO4rNablqzZjC4qAFjCNGleignkdCpftKcGsVzKIP+GjYdbq Cb+IkyNQS+xMJBP+VBB+bwerNe8RvS90krEBfjysLSaFR/DIAU2sVQZx85yajfU/3aOM uEV9M4biMdbSUo5Pya/EN3/5z6xhnMUE4ycLflDzneOEmcb3Ynz5gLDjabhn3O35eXds w1dh9mhCy+X63iptXwRthCZ30BUd81z7LkAjQp2uEyV+XeFZP3p546nZPcL+c2vW8eFM 1QCwAH+9TMmO9WIbWoC0ADu/CMdHFIoAQWSQxQdSNFfJKr10d+BdTsMYUVwE/s7C4T33 99aQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=i1zDof6OtvGZP5SPndoQ1fuuVqZzAR4cxcPoesi3UZQ=; b=n6WIqLan9a4FMeKg5REDRkfpOi7JiKUV8xknpntwekzxeHAbVYr/q6y/5VEiHP8M20 aVqSOQjcffTaKt344KrzOZWLIfXAFLEa4io9KEB6KkjeVE/zYC8xOxHtJXeeg3Abn/cL 0GYDxIWsZxtE/6v5IZM+z04NrffsnE9PX34vzDvlaMTP9nvPH2X9++bJQ/HbNOmqFpJP 91A7d8rW5AoTjauW/mYS5Sbglgrce9iP0UltrjcTQwhO5PrjTkLDdwPPqE7gDEB3hF7p njyCktQuaZkcnvtmx2amBHEuu40JMsyKfy09X30m9Ed+uh6kCQzvi6sfqdZNNk+ubv6k hVXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=LXQbGXSn; 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 m21-20020a63ed55000000b0043a0107d46asi1648778pgk.727.2022.09.17.21.36.23; Sat, 17 Sep 2022 21:36:34 -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=LXQbGXSn; 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 S229602AbiIREfJ (ORCPT + 99 others); Sun, 18 Sep 2022 00:35:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbiIREfG (ORCPT ); Sun, 18 Sep 2022 00:35:06 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C14F13F51 for ; Sat, 17 Sep 2022 21:35:04 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id fv3so24770208pjb.0 for ; Sat, 17 Sep 2022 21:35:04 -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:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=i1zDof6OtvGZP5SPndoQ1fuuVqZzAR4cxcPoesi3UZQ=; b=LXQbGXSnCu1RB9u7uebnc9Z0LaBzCWIEB/4qpF887O03nW02QEWF/azLZaiU9xfarr 9deDlOP6adhCM/Y58+MSjvXnuN4LLdvpncUTRoyxPgwWyzey9uarYsrh+RjQtNo5Di3y nyhWnSubU15bSHOrKdQRtjLObKZioWl7yL/PiueXpSk9E4p2bwNp8H+EQV3OvM+WwmVW MTx3KaNpaWGtmCasoChP+CJi57On5fQlVyXp5KEgKIaQDRunYMe5iBqypbiqqosI7A6D L7qqd+2LcmLRs+vz8DSlZ64bpppcmXyFbhQGreAZO75DNBqtlm9NqOa85jeTc3g4Xlq6 XFNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=i1zDof6OtvGZP5SPndoQ1fuuVqZzAR4cxcPoesi3UZQ=; b=6es1YOhHIPwgQ51tk8NpAwZoTGcg5Kfn375RaqPMr6hi26zWUDdgpigW2vw4ribRD6 2ufjJP+HyTqloihvfARxxhy0abAGhflUS2F6QZKowDkSxuKHC2kkuHYBD0vCabVsxFc6 6CHwN4rVNnTBBC+8sru34t16qtyegGRctB5LB7wIen4rIFvlcHrh2UVpTCAczKfHy0JW qpEUkoiYAzGYowoFpTrGjT7lKilhozKJDXVWEM6roSID1NjLx3B67uHwvON3+eVF9YXO Z549g6UZuiugmUE0Po4HJxyG91QTN4ymb8do5QtbhQywrNL/yxC+Au13kanrEplOICan 4Ubw== X-Gm-Message-State: ACrzQf0wJEr62mZ3I1IXNb2985wWAaAveheeRE4yGLcso8eNIpnUXGTo BS9/Upx35/Iu9zTASb5sR8K6DQ== X-Received: by 2002:a17:90a:e60d:b0:201:6b28:5406 with SMTP id j13-20020a17090ae60d00b002016b285406mr23615945pjy.228.1663475703591; Sat, 17 Sep 2022 21:35:03 -0700 (PDT) Received: from localhost.localdomain ([111.201.134.95]) by smtp.gmail.com with ESMTPSA id l63-20020a622542000000b0054b5239f7fesm3955248pfl.210.2022.09.17.21.35.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Sep 2022 21:35:03 -0700 (PDT) From: Jia Zhu To: linux-erofs@lists.ozlabs.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, yinxin.x@bytedance.com, jefflexu@linux.alibaba.com, Jia Zhu Subject: [PATCH V6 0/6] Introduce erofs shared domain Date: Sun, 18 Sep 2022 12:34:50 +0800 Message-Id: <20220918043456.147-1-zhujia.zj@bytedance.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) 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 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 [Kernel Patchset] =============== Git tree: https://github.com/userzj/linux.git zhujia/shared-domain-v6 Git web: https://github.com/userzj/linux/tree/zhujia/shared-domain-v6 [User Daemon for Quick Test] ============================ Git web: https://github.com/userzj/demand-read-cachefilesd/tree/shared-domain More test cases will be added to: https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/log/?h=experimental-tests-fscache [E2E Container Demo for Quick Test] =================================== [Issue] https://github.com/containerd/nydus-snapshotter/issues/161 [PR] https://github.com/containerd/nydus-snapshotter/pull/162 [Background] ============ In ondemand read mode, we use individual volume to present an erofs mountpoint, cookies to present bootstrap and data blobs. In which case, since cookies can't be shared between fscache volumes, even if the data blobs between different mountpoints are exactly same, they can't be shared. [Introduction] ============== Here we introduce erofs shared domain to resolve above mentioned case. Several erofs filesystems can belong to one domain, and data blobs can be shared among these erofs filesystems of same domain. [Usage] Users could specify 'domain_id' mount option to create or join into a domain which reuses the same cookies(blobs). [Design] ======== 1. Use pseudo mnt to manage domain's lifecycle. 2. Use a linked list to maintain & traverse domains. 3. Use pseudo sb to create anonymous inode for recording cookie's info and manage cookies lifecycle. [Flow Path] =========== 1. User specify a new 'domain_id' in mount option. 1.1 Traverse domain list, compare domain_id with existing domain.[Miss] 1.2 Create a new domain(volume), add it to domain list. 1.3 Traverse pseudo sb's inode list, compare cookie name with existing cookies.[Miss] 1.4 Alloc new anonymous inodes and cookies. 2. User specify an existing 'domain_id' in mount option and the data blob is existed in domain. 2.1 Traverse domain list, compare domain_id with existing domain.[Hit] 2.2 Reuse the domain and increase its refcnt. 2.3 Traverse pseudo sb's inode list, compare cookie name with existing cookies.[Hit] 2.4 Reuse the cookie and increase its refcnt. RFC: https://lore.kernel.org/all/YxAlO%2FDHDrIAafR2@B-P7TQMD6M-0146.local/ V1: https://lore.kernel.org/all/20220902034748.60868-1-zhujia.zj@bytedance.com/ V2: https://lore.kernel.org/all/20220902105305.79687-1-zhujia.zj@bytedance.com/ V3: https://lore.kernel.org/all/20220914105041.42970-1-zhujia.zj@bytedance.com/ V4: https://lore.kernel.org/all/20220915124213.25767-1-zhujia.zj@bytedance.com/ V5: https://lore.kernel.org/all/20220916085940.89392-1-zhujia.zj@bytedance.com/ Jia Zhu (6): erofs: use kill_anon_super() to kill super in fscache mode erofs: code clean up for fscache erofs: introduce fscache-based domain erofs: introduce a pseudo mnt to manage shared cookies erofs: Support sharing cookies in the same domain erofs: introduce 'domain_id' mount option fs/erofs/fscache.c | 263 ++++++++++++++++++++++++++++++++++++++------ fs/erofs/internal.h | 32 ++++-- fs/erofs/super.c | 73 +++++++++--- fs/erofs/sysfs.c | 19 +++- 4 files changed, 324 insertions(+), 63 deletions(-) -- 2.20.1