Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp2232276rwj; Sun, 30 Oct 2022 13:45:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4aSMojJCFLA+sqZ7J9PFsH/AIvG0Nm02hSa6nN3KaV1PHvRspCz4ag0mDdIUkBCZXMzqGy X-Received: by 2002:a63:6d8a:0:b0:46f:57e9:f933 with SMTP id i132-20020a636d8a000000b0046f57e9f933mr9661523pgc.195.1667162758315; Sun, 30 Oct 2022 13:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667162758; cv=none; d=google.com; s=arc-20160816; b=SCujc+Uo27MrCHZ/9QUdGPHdZYZPRDrXQkU5u49piTtIHcQvvqZ+arw93t2bEBNDpS JT8v72wwob/HSycCM2AQQcmIneGlDOHF7RfCSW+ummTusstNVpQyN/FqkqwJzO3Ssb0q ftWonOAYECA2s9LKycwA9ZnaiDftu6JLxJAbdET3rUJaD9xBfw006/DuBFs6mBElHVHZ rcXPOvCIZbw7YdBy4DH9mmWgNxJ1ObOfvJIomw4feB8XZx3vhdcucTkOy6TCT2IhRg7L 507lmi7KZTiQcQXvnMZY1SRtF4+YRR14OaGWPD9Cejgak+Mm3pHPCB8/4uhOrusczaCK qgzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=GjHcp/wdMbwEfGBYGedZOimxPCDQynRkjHeEm6VDjxY=; b=uwn9xPAYAwUHRD/alR3iZd5nEiGbvs7m2Eu0TVBQq2z/CnFJdJfoccg2xOvu0whqMt TcY1N7NQBmlhPOvEj/xSR0+rv2vZO9hbwUx6lRm/vDkaVqfit/HFP36y31ecyz2Ng2Se uud7N4irxGHPhMxfry/Och/gL4SFM5SvFjWU0UhR1KK9fjReqrwM2pRe+p5KDWmcH00o tw1UBVdFOFT0TKksDxmiG5L4lqiPfFUCWgp+hHZexcAs4zFP+zMyjvMM2ya43nqTqbJ1 XS59a6kxV15eMQSdbNTptUFveAGujJJ35VJnjUMfV6yYRBYsFx1qLYuncS95fU+CikH4 BB0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=i8A+0CXC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a17-20020a656051000000b0046174e5ceaasi6751435pgp.656.2022.10.30.13.45.45; Sun, 30 Oct 2022 13:45:58 -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=@linux.org.uk header.s=zeniv-20220401 header.b=i8A+0CXC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229635AbiJ3U2t (ORCPT + 99 others); Sun, 30 Oct 2022 16:28:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbiJ3U2r (ORCPT ); Sun, 30 Oct 2022 16:28:47 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FB83A185; Sun, 30 Oct 2022 13:28:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=GjHcp/wdMbwEfGBYGedZOimxPCDQynRkjHeEm6VDjxY=; b=i8A+0CXCpFmEwaRWYLuk3I/7qh 4rSg5bGpqNEWlx1autk6G5pN6F7UE6N41M0041G4TRIZKOrZnXCtG5maJ2HluqRWqNCKQ8gdyUR4w Mybf85r8I9Y4rALKoycInK0hKJAeERO+fp/sAKuVFqBe1wzkPq6Bih9bhoIFbXVGo24l+asWjQANM AYWtLsKwLgFZI6d5jYGPx1lo0sFVWXXv5Zt9HuO8U4QJdESYKo8oBkJN9YJ5FEsxmjiOexOnxtgZG mf4iEeOzJhaqj94XRE/cfWW+ALgfWNYemIdKVebNNgDiJkpWpyHEPygr1oQjD9l3iomyxJsrYiADV mKUbYThg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1opEv9-00GPxE-34; Sun, 30 Oct 2022 20:28:40 +0000 Date: Sun, 30 Oct 2022 20:28:39 +0000 From: Al Viro To: Dawei Li Cc: brauner@kernel.org, neilb@suse.de, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] vfs: Make vfs_get_super() internal Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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 On Sun, Oct 30, 2022 at 09:06:08PM +0800, Dawei Li wrote: > For now there are no external callers of vfs_get_super(), > so just make it an internal API. > > v1: https://lore.kernel.org/all/TYCP286MB2323D37F4F6400FD07D7C7F7CA319@TYCP286MB2323.JPNP286.PROD.OUTLOOK.COM/ > > v2: move vfs_get_super_keying to super.c, as the suggestion > from Christian Brauner. > > base-commit: 3aca47127a646165965ff52803e2b269eed91afc > > Signed-off-by: Dawei Li > --- > fs/super.c | 13 +++++++++++-- > include/linux/fs_context.h | 14 -------------- > 2 files changed, 11 insertions(+), 16 deletions(-) > > diff --git a/fs/super.c b/fs/super.c > index 6a82660e1adb..24e31e458552 100644 > --- a/fs/super.c > +++ b/fs/super.c > @@ -1111,6 +1111,16 @@ static int test_single_super(struct super_block *s, struct fs_context *fc) > return 1; > } > > +/* > + * sget() wrappers to be called from the ->get_tree() op. > + */ > +enum vfs_get_super_keying { > + vfs_get_single_super, /* Only one such superblock may exist */ > + vfs_get_single_reconf_super, /* As above, but reconfigure if it exists */ > + vfs_get_keyed_super, /* Superblocks with different s_fs_info keys may exist */ > + vfs_get_independent_super, /* Multiple independent superblocks may exist */ > +}; I would rather kill the "keying" thing completely. Seriously, what does it buy us? Consider e.g. return vfs_get_super(fc, vfs_get_independent_super, fill_super); in get_tree_nodev(). If you expand vfs_get_super() there, you'll get this: { struct super_block *sb = sget_fc(fc, NULL, set_anon_super_fc); if (IS_ERR(sb)) return PTR_ERR(sb); if (!sb->s_root) { int err = fill_super(sb, fc); if (unlikely(err)) { deactivate_locked_super(sb); return err; } sb->s_flags |= SB_ACTIVE; } fc->root = dget(sb->s_root); return 0; } Sure, it's several lines long, but it's much easier to follow than vfs_get_super(). And duplication between these vfs_get_super() callers is, IMO, not worth eliminating...