Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2525561rdb; Fri, 22 Sep 2023 00:44:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHI+4sazwxgbxDkzBccXv1Lmr/WXpsLHS0nMSB/yXgoRXdWv7TV4lLd872yCnxx/Wk5D1gB X-Received: by 2002:a17:902:d381:b0:1bb:b74c:88f6 with SMTP id e1-20020a170902d38100b001bbb74c88f6mr6507186pld.16.1695368642174; Fri, 22 Sep 2023 00:44:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695368642; cv=none; d=google.com; s=arc-20160816; b=cnIg5+5zp9Wpz6Jgy3W+jOYhcij5pGUd6IK/6whPKUZUek+jbGrbSL/v7SiYkPEjfT lWE4PqD92wyVSGEOu+TMukfmfpYSJhR4CjNRfTD3FHHgsLmQPZ55ZSYOfWGJskELBffY OQswAtqsHesjxRmqCUARVpfrIc5P4PJJ8rWMOYxgRbQzo3pmGVc4MH/EFilX5UQT5wR7 9promLsrbp2kdU9cd/bkh5dH9ZzmnN0DaovlK1QQcEI6qjN3WTkO5LxQwoTAc0UJt9dR vlmInCNxkjagULGyUSjluU/bQEr7dp08FnrgWoPH0OAA0aAz9J7v5MTUT59DhDmEzXyQ G5/A== 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 Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id b4-20020a170902650400b001c4329b77bfsi3103418plk.123.2023.09.22.00.43.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 00:44:02 -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 4B86A80A0E1F; Thu, 21 Sep 2023 21:13:40 -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 S230265AbjIVENF (ORCPT + 99 others); Fri, 22 Sep 2023 00:13:05 -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 Content-Transfer-Encoding: 8bit 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:40 -0700 (PDT) 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; -- 2.41.0