Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp508366rwe; Wed, 31 Aug 2022 06:35:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Lt7FPujqc1FH6AwDGCZ2EABNtWWxN9aSmka0x5FtjpiG36xav4UM+CrufuMOGc4yIdNLq X-Received: by 2002:a17:906:8a4e:b0:730:9fcd:d988 with SMTP id gx14-20020a1709068a4e00b007309fcdd988mr20328955ejc.636.1661952934168; Wed, 31 Aug 2022 06:35:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661952934; cv=none; d=google.com; s=arc-20160816; b=da9ePqLa5NA6+sVBIHhdpVgOeXwVQwia1bV6UCHebRghTSSCmq6IUSyoTiLAUXZ4df OSw9am49L6d+IShW88F9FH7i3221GPqN6iyxNCTJzaNh48OeN+5yqwZvgF3pYZ2S+BJe W/cmFybR1Avxmfkib/o7YaU8eNjJgNDTvi81yT7/7dZSW4O0uRl0oQWht7tZ7fjq1g57 16KU3q7g3gSsCFui4UNoSMwgwFTTM9xVVY6kJbO3Wl9fSgK+iTEEp6ZXL5AlOjCY3axU +DDNWFQr1VrxiYHUs7PxRHErpmUvyppGbYy9FaC2LMMJq/uibtjjxIoc9VK8h+rnj6r9 xEFQ== 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=/63KM3wyfELIawz0klhvCCYXeq+xfEs4T43zEY9eKME=; b=XFr8dv3gqMuhXmcCERJJlt9WR/6Pcdvg0x/Vs3MmhqVy3h7kpP1Cdf2vHLIXCO7KTZ qtmNyDxrUuiVQUKY0QELToYdepK218gFkshGtOabqSFzwvKvXSA1/rIjsU8Xe09Ba/8z zzzSFQH4XrmlBAePMDCW14Gr3UDYWa4VquqIwcxrZVgabz2r7f42xBq/HiFDwrw7ZeWh x9EbVPaZ2v4Ziupxy7QEWWdTgr2JZ4wD4xkOUj6zJZirWUcpKe9McCfn+np7VMOJ/6uy K+fKmIvap02vOFAMOpfsLdf480g5l1JRZC3Uj3o05Xw6VrSLNDWFaYc+txf0uxFO5Cuy uTbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=M8H8JUbI; 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 w20-20020a05640234d400b004486d3bcacdsi6927662edc.5.2022.08.31.06.35.08; Wed, 31 Aug 2022 06:35: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=M8H8JUbI; 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 S231206AbiHaMcK (ORCPT + 99 others); Wed, 31 Aug 2022 08:32:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231194AbiHaMcE (ORCPT ); Wed, 31 Aug 2022 08:32:04 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 303F3D1E0D for ; Wed, 31 Aug 2022 05:32:03 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id q3so10750038pjg.3 for ; Wed, 31 Aug 2022 05:32:03 -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=/63KM3wyfELIawz0klhvCCYXeq+xfEs4T43zEY9eKME=; b=M8H8JUbIYde0xqj3oQuttD73l6sjhdY9fhJcRMSEilPziu1+x5YARpHDcsixAvcUJr /IiCcMRdOM3pXrAcUM/e6IglwRHWSjWnzBrV6P0pmgPMe5sNveuq4yJiNHTEu9PRfG6j oEfTZYzYcKJXV2/XqsFSBq/TsqcYl5AyMWUpijwHDumSEZUDfMTK3i0WknLnZ58eH7Au moAPwCyCSwq6WwS+8mQsw+zbnv34gT4lg7bPkvk05TK6xVEwJpSglJcP8zQo8W+plYBM tW8IQwejRhDBj3hxqrykkMTd6/mwAwfCE7BK4Pgdjv4EAEP7RiTfa3HKRxrQRpczzMmd Vq8A== 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=/63KM3wyfELIawz0klhvCCYXeq+xfEs4T43zEY9eKME=; b=kxIswL45AFyM70I0C34pnccX7bnuHlDZ32zwRsiRf9XZZyMPcc/s1E4KpND/Hj1xo+ b1vbCx8MCZ1pIQTFUARZZSSG7LMGFrZ/RvEOQyissWWas7ZDSVcWD/x6IZmzKEzhxlcZ rBP9aiYTq3ArvBz9t1gdbr3SoDv+HjLemcZQuAuuSNzgJhbFdOxWn5ams1ZkrP4YXhUY HcqM3a+/vd+kprk6tzqvFCMDOMHANM47v5w/8Skapr0Du2c60uFGvsHEGdOU/Q4+l2BY jiwCIn9bZMoD3crN/RbLwJQ16EVcCofE+Skf5OHKGPoaq+ZGKkg730RfpuNx9dAJCK9P LYAw== X-Gm-Message-State: ACgBeo2kAuSK3eyfkkd5jZA8LVtLDkk2diVIunhKyNeWoystnJbRQDRm gJX1gbQKrqFQeYw99kfMiH1tBg== X-Received: by 2002:a17:902:f64a:b0:172:7576:2124 with SMTP id m10-20020a170902f64a00b0017275762124mr25020406plg.155.1661949122637; Wed, 31 Aug 2022 05:32:02 -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.31.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 05:32:02 -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 1/5] erofs: add 'domain_id' mount option for on-demand read sementics Date: Wed, 31 Aug 2022 20:31:21 +0800 Message-Id: <20220831123125.68693-2-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=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 Introduce 'domain_id' mount option to enable shared domain sementics. In which case, the related cookie is shared if two mountpoints in the same domain have the same data blob. Users could specify the name of domain by this mount option. Signed-off-by: Jia Zhu --- fs/erofs/internal.h | 1 + fs/erofs/super.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index cfee49d33b95..fe435d077f1a 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -76,6 +76,7 @@ struct erofs_mount_opts { #endif unsigned int mount_opt; char *fsid; + char *domain_id; }; struct erofs_dev_context { diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 3173debeaa5a..fb5a84a07bd5 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -440,6 +440,7 @@ enum { Opt_dax_enum, Opt_device, Opt_fsid, + Opt_domain_id, Opt_err }; @@ -465,6 +466,7 @@ static const struct fs_parameter_spec erofs_fs_parameters[] = { fsparam_enum("dax", Opt_dax_enum, erofs_dax_param_enums), fsparam_string("device", Opt_device), fsparam_string("fsid", Opt_fsid), + fsparam_string("domain_id", Opt_domain_id), {} }; @@ -568,6 +570,16 @@ static int erofs_fc_parse_param(struct fs_context *fc, return -ENOMEM; #else errorfc(fc, "fsid option not supported"); +#endif + break; + case Opt_domain_id: + kfree(ctx->opt.domain_id); + ctx->opt.domain_id = kstrdup(param->string, GFP_KERNEL); + if (!ctx->opt.domain_id) + return -ENOMEM; +#ifdef CONFIG_EROFS_FS_ONDEMAND +#else + errorfc(fc, "domain_id option not supported"); #endif break; default: @@ -695,6 +707,7 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_fs_info = sbi; sbi->opt = ctx->opt; ctx->opt.fsid = NULL; + ctx->opt.domain_id = NULL; sbi->devs = ctx->devs; ctx->devs = NULL; @@ -838,6 +851,7 @@ static void erofs_fc_free(struct fs_context *fc) erofs_free_dev_context(ctx->devs); kfree(ctx->opt.fsid); + kfree(ctx->opt.domain_id); kfree(ctx); } @@ -892,6 +906,7 @@ static void erofs_kill_sb(struct super_block *sb) erofs_fscache_unregister_cookie(&sbi->s_fscache); erofs_fscache_unregister_fs(sb); kfree(sbi->opt.fsid); + kfree(sbi->opt.domain_id); kfree(sbi); sb->s_fs_info = NULL; } @@ -1044,6 +1059,8 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root) #ifdef CONFIG_EROFS_FS_ONDEMAND if (opt->fsid) seq_printf(seq, ",fsid=%s", opt->fsid); + if (opt->domain_id) + seq_printf(seq, ",domain_id=%s", opt->domain_id); #endif return 0; } -- 2.20.1