Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2228318rdb; Thu, 21 Sep 2023 12:08:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvxtcjPIq9DOtLWskaEAmb+uFZzH+EJ5CWF1CcQ5qd0XGrQWcMKzZ3x2bhVKKo/vxAhUbT X-Received: by 2002:a05:6a00:26e3:b0:68f:b986:ff69 with SMTP id p35-20020a056a0026e300b0068fb986ff69mr637505pfw.6.1695323326549; Thu, 21 Sep 2023 12:08:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695323326; cv=none; d=google.com; s=arc-20160816; b=DHqA1bNWBZDj4oiNCPPE98LNlM5+GrzLZlNoTkFCKOOjo6EoDwB4cQfUZqniNuGB4T fCo8ROuD9lkdteu0luvMXGHGB57f7IYOS/7xk1uXIhv1YvrigBJdusMI6M1UGhfujfnd +OKK0WJwOyybTFiKgI1GJO+tMIfmAIh9A+886fNaAi8rV9DftOfk6olikBtMvoHg7vbw olHU0affs7tDEKj+XgkRZGVuzmleD9gz/pgn0TgJHVIJKfEoDZq2y9XE2jVycd++gMtR gDZXRuRCE2hXpHH1RflC/TXilSgKu2J6rJ3wKMpcgFPtLbtkpXwjbtYlLMhxbhsvyd/K g4Ug== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject; bh=cG/9BQFlv/L4jyOo38H5cZPQdh9yQlVijN6aCcoHRnk=; fh=Vd00GRLUNDtgftEBzBaifz0ZIGFRdtawsvTRUw5VTu8=; b=STMJkHch7M+0V/DdgDGdDzL2IGBcINP2iJpk3ihj2EOt9LXilabJygxRSqSiHTdto0 p6vVh2bmTx1EoUBg8rIieKHqZLQ30tkI7NSretv45a7JgloxhWybLSA/jb0ecEPNcgDy 7G9AQnE4om2Vzj30aihbddVlQXPWi0zko2C0fr3Qgf5XSEDBzSAqA8ROraKEBXE9LS8k eo55IUo3mdfXXYRnvkp3d2rz1YEt4TjxkSXQgIrdzfP+/D8zZnXSs+YR00KFPQeq6zTq Hut3NmA7IKVvJhjjue9Eo9SuPmymtjN/Go0YCB+uj71bfFpZbqC3OJSykLnKpr4aIKq8 MlSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id s11-20020a65644b000000b0057884435a72si1997580pgv.665.2023.09.21.12.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:08:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 4828880DCA48; Thu, 21 Sep 2023 11:57:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229805AbjIUS5b (ORCPT + 99 others); Thu, 21 Sep 2023 14:57:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbjIUS5A (ORCPT ); Thu, 21 Sep 2023 14:57:00 -0400 Received: from smtp01.aussiebb.com.au (smtp01.aussiebb.com.au [IPv6:2403:5800:3:25::1001]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 431708FB3E; Thu, 21 Sep 2023 11:51:05 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp01.aussiebb.com.au (Postfix) with ESMTP id 7F837100321; Thu, 21 Sep 2023 17:03:46 +1000 (AEST) X-Virus-Scanned: Debian amavisd-new at smtp01.aussiebb.com.au Received: from smtp01.aussiebb.com.au ([127.0.0.1]) by localhost (smtp01.aussiebb.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cS9HrQngyQhG; Thu, 21 Sep 2023 17:03:46 +1000 (AEST) Received: by smtp01.aussiebb.com.au (Postfix, from userid 116) id 7620310056B; Thu, 21 Sep 2023 17:03:46 +1000 (AEST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from donald.themaw.net (180-150-90-198.b4965a.per.nbn.aussiebb.net [180.150.90.198]) by smtp01.aussiebb.com.au (Postfix) with ESMTP id A40B81002AE; Thu, 21 Sep 2023 17:03:45 +1000 (AEST) Subject: [PATCH 3/8] autofs - refactor super block info init From: Ian Kent To: Al Viro , Christian Brauner Cc: autofs mailing list , linux-fsdevel , Kernel Mailing List , Bill O'Donnell , Miklos Szeredi , David Howells Date: Thu, 21 Sep 2023 15:03:45 +0800 Message-ID: <169527982522.27328.18413711550740966247.stgit@donald.themaw.net> In-Reply-To: <169527971702.27328.16272807830250040704.stgit@donald.themaw.net> References: <169527971702.27328.16272807830250040704.stgit@donald.themaw.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 (agentk.vger.email [0.0.0.0]); Thu, 21 Sep 2023 11:57:48 -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;