From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29B2CECAAA1 for ; Thu, 15 Sep 2022 12:42:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230064AbiIOMmf (ORCPT ); Thu, 15 Sep 2022 08:42:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230023AbiIOMma (ORCPT ); Thu, 15 Sep 2022 08:42:30 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ED3118E00 for ; Thu, 15 Sep 2022 05:42:29 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id w2so7656091pfb.0 for ; Thu, 15 Sep 2022 05:42:29 -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=7R+j7wZtr6PMHfqjiv3nkV/a0UcoizsRKOwYLocOZGY=; b=ZcehTf+g6XANFF260jYKGNH1MHnPD/8e3qg1uMSIVbEZsbO2mQ1a91g5+kBrfmMc8D df95AQ58en4aIwU8Cqhuws2yBIc7M/pgkzQsOMajpAkm1AcrX8fZYCzBPukSqShDiQEc 1HTxogrPOBliLkhrNXxnbyz2NGS3F1sXZBaPguGlVZoNAzv62yCkgrgCMWb653glMssm LI4nQUt6aoXUVur2AGuLWJ3JiaIgS3/mejYmAWKit/XKdLLxB9kagZBBdo0JgrPZzLvf PGmZj+14574uE00vgdJIuCMlXssnh0COFDE8xHpiSGmt3AE+Q77VdYews3P6Zr4tIp5n r9Vw== 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=7R+j7wZtr6PMHfqjiv3nkV/a0UcoizsRKOwYLocOZGY=; b=CMBnmaiVB9u04mHqbJ4D6kTmi7kPsDRAdTXb875T7e3BVQXWSCiPWsUW65d6/RROxs bTmG+k9C1GlC+cUEQpb4SpTChdEaudhvnPQHuFuUJ/h4URvceqZgNeGG0ZF6nuEa82Kl AOb0H04evqrCVdRzIoxTKREKHS1sGAsU/ssHQps//arYE92t/Q3Ep3t4xewm6W6hV0pb mmd0Ki2cGU77jKEf51FugRoHLO4IZxZ8K3ugv5Ju9GEkmMqMLda4LmTmLlg9NBnMeQzX cQM4U8e4mQIIqDVML6Mei+co+q/GfBh/edJ8amfAzBfhx+9G5IT+ks4SBYVyYaH23zvE 828w== X-Gm-Message-State: ACgBeo2wMWopgwSrgklWEYndssg28kogAcvCCZfjo6VYZyxFIUQ4WdRR QFYXv2c6LS6eW/pRQElYDF8TQQ== X-Google-Smtp-Source: AA6agR48s/xjOTWg6C4e0X1Y+joB/hhyF2EiMG4yEQMB7vlw4rdRJ/Bd2KRlsLAK79QiVzKyVXdXEQ== X-Received: by 2002:a05:6a00:1149:b0:53e:62c8:10bc with SMTP id b9-20020a056a00114900b0053e62c810bcmr41667054pfm.49.1663245748645; Thu, 15 Sep 2022 05:42:28 -0700 (PDT) Received: from C02G705SMD6V.bytedance.net ([61.120.150.76]) by smtp.gmail.com with ESMTPSA id p8-20020a170902780800b001637529493esm12721906pll.66.2022.09.15.05.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 05:42:27 -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 V4 0/6] Introduce erofs shared domain Date: Thu, 15 Sep 2022 20:42:07 +0800 Message-Id: <20220915124213.25767-1-zhujia.zj@bytedance.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changes since V3: 1. Avoid race condition. 1.1. Relinquish the volume before removing the domain from list. 1.2. Hold erofs_domain_list_lock before dec the refcnt of domain. 2. Relinquish previously registered erofs_fscache in erofs_fscache_domain_init_cookie()'s error handling path. 3. Some code cleanups without logic change. [Kernel Patchset] =============== Git tree: https://github.com/userzj/linux.git zhujia/shared-domain-v4 Git web: https://github.com/userzj/linux/tree/zhujia/shared-domain-v4 [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/ 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 | 253 ++++++++++++++++++++++++++++++++++++++------ fs/erofs/internal.h | 30 ++++-- fs/erofs/super.c | 72 ++++++++++--- fs/erofs/sysfs.c | 19 +++- 4 files changed, 317 insertions(+), 57 deletions(-) -- 2.20.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4453BECAAD3 for ; Thu, 15 Sep 2022 12:42:41 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4MSxgM4t3qz3blT for ; Thu, 15 Sep 2022 22:42:39 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bytedance-com.20210112.gappssmtp.com header.i=@bytedance-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=ZcehTf+g; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=bytedance.com (client-ip=2607:f8b0:4864:20::42f; helo=mail-pf1-x42f.google.com; envelope-from=zhujia.zj@bytedance.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bytedance-com.20210112.gappssmtp.com header.i=@bytedance-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=ZcehTf+g; dkim-atps=neutral Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4MSxgD5Cp6z2xJD for ; Thu, 15 Sep 2022 22:42:32 +1000 (AEST) Received: by mail-pf1-x42f.google.com with SMTP id a80so9355710pfa.4 for ; Thu, 15 Sep 2022 05:42:32 -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=7R+j7wZtr6PMHfqjiv3nkV/a0UcoizsRKOwYLocOZGY=; b=ZcehTf+g6XANFF260jYKGNH1MHnPD/8e3qg1uMSIVbEZsbO2mQ1a91g5+kBrfmMc8D df95AQ58en4aIwU8Cqhuws2yBIc7M/pgkzQsOMajpAkm1AcrX8fZYCzBPukSqShDiQEc 1HTxogrPOBliLkhrNXxnbyz2NGS3F1sXZBaPguGlVZoNAzv62yCkgrgCMWb653glMssm LI4nQUt6aoXUVur2AGuLWJ3JiaIgS3/mejYmAWKit/XKdLLxB9kagZBBdo0JgrPZzLvf PGmZj+14574uE00vgdJIuCMlXssnh0COFDE8xHpiSGmt3AE+Q77VdYews3P6Zr4tIp5n r9Vw== 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=7R+j7wZtr6PMHfqjiv3nkV/a0UcoizsRKOwYLocOZGY=; b=X4DXCHJWdxvHuxeORJ1V7EWuCQyXYqNY3ZSa34+kMygNo6upD6Ibqnry45sMo0Z1ad cLSU2nSWkjzTY/2z4SBj3YgJ7GX1ossw1vo/PJlePxe8W3FsByJLiKki0AjM3cxUFCpO 8PifFvbrBTZtcHtjX3gmw+ZQAX1WGl0Lk0p5i+u+/g8I1LGSyn64iS2ApCp6n3Vbh8Sh ev+FvOqjMHisRG9x4uJT8DDP0/i7i+GY8jYnfiIYnR+BeR+Her4dj6lUR4Bk7D20PwxE c9nYDqdJs8fvBCZI0gAxBb+Q8XuC6TQJZqGyp1yBFN/LrQ5AxNvtTcNn/PydC0L0YMxx I+SA== X-Gm-Message-State: ACgBeo31INI6j23V8Is1wUvVGWcxpPOYcWsrjzbOpcm4bSysN0g1QPlw 6yYRsfI31+GOozTri5Sp6N7f9caUznLnhA== X-Google-Smtp-Source: AA6agR48s/xjOTWg6C4e0X1Y+joB/hhyF2EiMG4yEQMB7vlw4rdRJ/Bd2KRlsLAK79QiVzKyVXdXEQ== X-Received: by 2002:a05:6a00:1149:b0:53e:62c8:10bc with SMTP id b9-20020a056a00114900b0053e62c810bcmr41667054pfm.49.1663245748645; Thu, 15 Sep 2022 05:42:28 -0700 (PDT) Received: from C02G705SMD6V.bytedance.net ([61.120.150.76]) by smtp.gmail.com with ESMTPSA id p8-20020a170902780800b001637529493esm12721906pll.66.2022.09.15.05.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 05:42:27 -0700 (PDT) From: Jia Zhu To: linux-erofs@lists.ozlabs.org Subject: [PATCH V4 0/6] Introduce erofs shared domain Date: Thu, 15 Sep 2022 20:42:07 +0800 Message-Id: <20220915124213.25767-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-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, yinxin.x@bytedance.com Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" Changes since V3: 1. Avoid race condition. 1.1. Relinquish the volume before removing the domain from list. 1.2. Hold erofs_domain_list_lock before dec the refcnt of domain. 2. Relinquish previously registered erofs_fscache in erofs_fscache_domain_init_cookie()'s error handling path. 3. Some code cleanups without logic change. [Kernel Patchset] =============== Git tree: https://github.com/userzj/linux.git zhujia/shared-domain-v4 Git web: https://github.com/userzj/linux/tree/zhujia/shared-domain-v4 [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/ 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 | 253 ++++++++++++++++++++++++++++++++++++++------ fs/erofs/internal.h | 30 ++++-- fs/erofs/super.c | 72 ++++++++++--- fs/erofs/sysfs.c | 19 +++- 4 files changed, 317 insertions(+), 57 deletions(-) -- 2.20.1