From patchwork Fri Sep 22 04:12:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Kent X-Patchwork-Id: 143192 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5338306vqi; Thu, 21 Sep 2023 22:33:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF82TCKUh7xKu3csL7cvgOUwKnBAQXGf/DvzkqVrhjoIs5q456kfj4+Xn7W+2nFxyQo3kiw X-Received: by 2002:a05:6a00:18a9:b0:68f:cdf3:dd54 with SMTP id x41-20020a056a0018a900b0068fcdf3dd54mr7792003pfh.9.1695360816162; Thu, 21 Sep 2023 22:33:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695360816; cv=none; d=google.com; s=arc-20160816; b=hC0ofaCou3iwN+BwMvUjaKv5MHE3LFjA/IoZY16F+H6FOjYf3HvvVYanUO/tBrrcCZ AMMmMUK/UEHbZtkL6WEytTKCO2Ss63JAdrYrWWk0LXWKaLhZHKK1h7eRAt+PT1fkBDfL 8E52n/wu9aNf9Lizib3MUW6U+yorPPeGfln6y/X0YPWjdmGH0Hmm1+SRH8rUJp2eB3v0 YKKp8/p5A5sNxfdolgcH8imUw1UFPVb7RvMVzX8a0vtEPQOnayGMyA9aCZzlEPs/2P0p cr//t+PBdOHQCXlbiDmPNNZvflZ820/s89OolvMxZ+P4mVymasRIJ8g9OvQYK3ZWH3M+ aH9A== 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 :feedback-id:dkim-signature:dkim-signature; bh=WbaN132An1pGGYu2OwYGx9AA8K508D+ik2jKmw/3K8c=; fh=tOzwWtfY/Ihw0ZG9uDufqX7N1fYPvJMmg28cxm4BgX4=; b=V3K6syhzS4MgssQ8ghYotw+IiYIeFVE7PF3G2Dn6ykK8zZ0KAqu65Fh+DHvn70LpQ2 fOKAu9xTKiiRdmGqjsjuva6zyp+da8DVyVz1umPelvbsIQJialTkhSxKrlqZgRZ7ChCm GiMFO1TPkoBGEndU+PIKQBEmz6gxPXrUyX7CaRGBKkKYuAjJbL4hmk+F89v5KjmiC35R JvbzViNwGXvCBoqWT650kji3yKbhJx08scFtb6SRTqFgro86jkM93knSKOcfRpstIZVX kQWxb7GETAloTQJgQdiuqLnSLMpO13GGQeGMZ2khbLPjHJUyMXJ9FcxMRiBsP2rRXvMf EiNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@themaw.net header.s=fm1 header.b=HzqjPsEF; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=jGUPW12f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id x7-20020a634847000000b0056c297d163csi2973305pgk.530.2023.09.21.22.33.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 22:33:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@themaw.net header.s=fm1 header.b=HzqjPsEF; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=jGUPW12f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A99B480990EC; Thu, 21 Sep 2023 21:13:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230300AbjIVENG (ORCPT + 30 others); Fri, 22 Sep 2023 00:13:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230124AbjIVENA (ORCPT ); Fri, 22 Sep 2023 00:13:00 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D22F1A6; Thu, 21 Sep 2023 21:12:45 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0151E5C0248; Fri, 22 Sep 2023 00:12:45 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 22 Sep 2023 00:12:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=themaw.net; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1695355964; x= 1695442364; bh=WbaN132An1pGGYu2OwYGx9AA8K508D+ik2jKmw/3K8c=; b=H zqjPsEFgQsMTX3cvZZnq+iJv81m9Iylso4uVo3DYw+7CsmpWoQeikVHmJ+MYFviM yNEzHomcixzheNwaOrfjI8StGrH919B3vYtn1lW+PyfWkKNguO+xSVUuFy9XnSbl Yumd/WneTgFjRCsG2hdWwCM6YXE5nestLNapL2kcenSpu4KHYDMSqEjj9Zjm57vw DeONTCe/oxjeS3w2klJybE1Isb/EMTLWzwQOtn5Bg2XfvStMixF4Sm6OyMO586zu n5pEuuvr3w8xJSAsk/LbMAWyzAXmr8IsmFjPHA62B3a1r0ats8X+YWYx1xCmE1fx 1cAGsdb3HzMhD/ETVWGfg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1695355964; x= 1695442364; bh=WbaN132An1pGGYu2OwYGx9AA8K508D+ik2jKmw/3K8c=; b=j GUPW12fWIFz2HJTEDeSYUuNkXycA4F5WxRqNKWC7gmrWuzTTTcffEo+bqQ6YAOaf M/0VuiAy2/BhbnCt83LfvYeIq+w7jdx3pArHokr1CWy1Uj+/axVzNn50q/1rbu6D nxvqi1wCXpa8y6r1PtIGAtlpb5cloJMAtWIVHFtqt6bL9A2aTn9DTGxeVtOVpVKY G8LHk0Q4FU6HWm+n7jDzzKHjg3KK21D8whA0KVSHXikZ8lVc2NsBh8NdHUR+lL+c Ilvto5gZANoD4l06PZuJ4ouIYKbI2hNgJF8/SwVhikM8mQmyiPZAfALmuZmVq27u I3qwwCdWIla2gA6KtO0Fw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudekjedgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepkfgrnhcu mfgvnhhtuceorhgrvhgvnhesthhhvghmrgifrdhnvghtqeenucggtffrrghtthgvrhhnpe duleegueffgfehudeufedtffeiudfghfejgeehvdffgefgjeetvdfffeeihfdvveenucev lhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehrrghvvghnse hthhgvmhgrfidrnhgvth X-ME-Proxy: Feedback-ID: i31e841b0:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 22 Sep 2023 00:12:40 -0400 (EDT) From: Ian Kent To: Al Viro , Christian Brauner Cc: autofs mailing list , linux-fsdevel , Kernel Mailing List , Bill O'Donnell , Miklos Szeredi , David Howells , Ian Kent Subject: [PATCH 3/8] autofs: refactor super block info init Date: Fri, 22 Sep 2023 12:12:10 +0800 Message-ID: <20230922041215.13675-4-raven@themaw.net> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230922041215.13675-1-raven@themaw.net> References: <20230922041215.13675-1-raven@themaw.net> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 21 Sep 2023 21:13:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777714663397257340 X-GMAIL-MSGID: 1777714663397257340 Move the allocation and initialisation of the super block info struct to its own function. Signed-off-by: Ian Kent --- fs/autofs/inode.c | 53 +++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c index e279e275b0a5..992d6cb29707 100644 --- a/fs/autofs/inode.c +++ b/fs/autofs/inode.c @@ -171,11 +171,6 @@ static int parse_options(char *options, root->i_uid = current_uid(); root->i_gid = current_gid(); - sbi->min_proto = AUTOFS_MIN_PROTO_VERSION; - sbi->max_proto = AUTOFS_MAX_PROTO_VERSION; - - sbi->pipefd = -1; - if (!options) return 1; @@ -248,41 +243,49 @@ static int parse_options(char *options, return (sbi->pipefd < 0); } -int autofs_fill_super(struct super_block *s, void *data, int silent) +static struct autofs_sb_info *autofs_alloc_sbi(void) { - struct inode *root_inode; - struct dentry *root; struct autofs_sb_info *sbi; - struct autofs_info *ino; - int pgrp = 0; - bool pgrp_set = false; - int ret = -EINVAL; sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); if (!sbi) - return -ENOMEM; - pr_debug("starting up, sbi = %p\n", sbi); + return NULL; - s->s_fs_info = sbi; sbi->magic = AUTOFS_SBI_MAGIC; - sbi->pipefd = -1; - sbi->pipe = NULL; - sbi->exp_timeout = 0; - sbi->oz_pgrp = NULL; - sbi->sb = s; - sbi->version = 0; - sbi->sub_version = 0; sbi->flags = AUTOFS_SBI_CATATONIC; + sbi->min_proto = AUTOFS_MIN_PROTO_VERSION; + sbi->max_proto = AUTOFS_MAX_PROTO_VERSION; + sbi->pipefd = -1; + set_autofs_type_indirect(&sbi->type); - sbi->min_proto = 0; - sbi->max_proto = 0; mutex_init(&sbi->wq_mutex); mutex_init(&sbi->pipe_mutex); spin_lock_init(&sbi->fs_lock); - sbi->queues = NULL; spin_lock_init(&sbi->lookup_lock); INIT_LIST_HEAD(&sbi->active_list); INIT_LIST_HEAD(&sbi->expiring_list); + + return sbi; +} + +int autofs_fill_super(struct super_block *s, void *data, int silent) +{ + struct inode *root_inode; + struct dentry *root; + struct autofs_sb_info *sbi; + struct autofs_info *ino; + int pgrp = 0; + bool pgrp_set = false; + int ret = -EINVAL; + + sbi = autofs_alloc_sbi(); + if (!sbi) + return -ENOMEM; + + pr_debug("starting up, sbi = %p\n", sbi); + + sbi->sb = s; + s->s_fs_info = sbi; s->s_blocksize = 1024; s->s_blocksize_bits = 10; s->s_magic = AUTOFS_SUPER_MAGIC;