Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3858576pxb; Tue, 7 Sep 2021 09:03:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyulJ8XO0KzEsueQrHL5Ni6NlwnqU9SjzFOkoancKrS/oEFfcvQuT1ZbdGdNLBF2x4od3pj X-Received: by 2002:a92:ca89:: with SMTP id t9mr12611184ilo.178.1631030598888; Tue, 07 Sep 2021 09:03:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631030598; cv=none; d=google.com; s=arc-20160816; b=GDVdnpjVo0uvJ8Be1sX+TfI78n7uYUp8JreLwNrC9/YcwZ8RlA4SReYv8ctFnzj8iG Sh7qcvpGVoKuf3JeB++4g+YKeFcraM1j2fonGE6Qiu6cki8AhfVKkRPhwbzF5fiaKo17 A1Qfo1oZBNi1GaZTV58RGX9bfILYaJD1v+S7PcekV0cXuHJrv5GeYmHDtuDAO5TqPks3 fgIOuI5KNj1EUKK9ei5YfcxyWsCk3kYbNHBYHvWtvwBpYudtvfEYhQapV7kdJp4JVuwB jhmmf8chbEv/Df6mX2SJOTn/VhOA6gp7vWdipITqknl+Q4Mw1ZGNZf8pNhLxNHDzC8YB eklw== 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=OHuhtZ/zqVhWYfOx8LjsJO6P40iCzJqotJXfGUPKwnc=; b=Risrb0+Vn7eeapvXof9FwkuKCQfu8HRibpYuPeLn2D20lQGqDwMS8zW1HPyBiLu8OO 3GDA2oJPhflC0s+Nd4USgo8GZJWMFS+ZHDV503mMxex7r3sDTNeJAIp0FlcXdKOYanL0 5EXre6SjFXW4lm8cIlAjheF88KAZUePjLkvtDVjRzMfF/yNyQRIxWAnG8iZfhxUjPagN tvxnrLBBCmvxf1KQI32fJ1vFSP7Ev8B37WanQ2Iqh+v7Y3rQloKfjkJVXEVLUGYqi8Ug DDyDT2Z8bwyrGXVXkxiKtYl1cUJZ0jdzVYm3H4caB4UZ35M2UjyfG2WCQGSB0IbY/Gkp LC/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=B0F59id0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k64si11473254iof.103.2021.09.07.09.03.06; Tue, 07 Sep 2021 09:03:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=B0F59id0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345505AbhIGPhg (ORCPT + 99 others); Tue, 7 Sep 2021 11:37:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345444AbhIGPh3 (ORCPT ); Tue, 7 Sep 2021 11:37:29 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C31EC0617AD; Tue, 7 Sep 2021 08:36:21 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id g14so17229075ljk.5; Tue, 07 Sep 2021 08:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OHuhtZ/zqVhWYfOx8LjsJO6P40iCzJqotJXfGUPKwnc=; b=B0F59id0u0nQtOm/ocn6TOkyxUaIoHlZF8W4Kgpux2eNqZR102GqOYBo1PtrOp/oHe 75CzGemW4B6iq/Z/6ypGu8xRBajPa5wuU9sE2lD1iBiyKnSmXSfRH9sjoUviGgRM8Mf/ jn2s3PlkTaM++9Fl6Wx8qm4xT/2h3coJ+Gmx0wkFuZQh4CbWw9FET8TAv9hMJ/x2z0q5 b2qhyraivB3dg0qqlOdaxH/w8yZ5Kjr1r6N8gbM2cPAXi1Dn83sxIc8GBMaXhUOUMxUI kppITuXWhZWGoLB0GY64Y4kcUFk4jvvRSLVrnOdR1EC7yTBvOlfs+2JkhjpFupXpQDFa 2nDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OHuhtZ/zqVhWYfOx8LjsJO6P40iCzJqotJXfGUPKwnc=; b=awhvoTxm1YAFCXKrpSk+ZW+qvvF01YBunXI+TBmQDc7GwuD0W4867kiTvfhebz5bFn 786bFE0A2J/3okEsSAy0bg7jLMXd6/GUKdtSjSDzB3HOMOhIn2ZLXNPWuFE4at4LUGYz I47EDGx83yzueUiqDfCzcNexpQ/4dm36QzNa8JoAdG/OgLJs3JJfhzSzcGjHzx4XdjKn 2TQ/Ei0/eb5TEBVG40P4LjRM4jTRFY2GBzfo2KOHuEDXOLd8jOgWqCUjkJPRPjzPI5SQ 3JRnjx03dbSGr44DIIEpYo8i85TIDmBUSOTjs33g9axHL+WgAKC2Tc00oG+gHOSJ+uz4 nSuQ== X-Gm-Message-State: AOAM530CFHLvpzSyG2ESJB2GMxYXkIVlsQ3rDS2XvR5jMQbpSPCBw5wS XZM+8wpoA1oU3IG+v7XfrxQ= X-Received: by 2002:a2e:8810:: with SMTP id x16mr15537678ljh.410.1631028978113; Tue, 07 Sep 2021 08:36:18 -0700 (PDT) Received: from kari-VirtualBox.telewell.oy ([31.132.12.44]) by smtp.gmail.com with ESMTPSA id p14sm1484458lji.56.2021.09.07.08.36.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Sep 2021 08:36:17 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , ntfs3@lists.linux.dev Cc: Kari Argillander , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v4 5/9] fs/ntfs3: Init spi more in init_fs_context than fill_super Date: Tue, 7 Sep 2021 18:35:53 +0300 Message-Id: <20210907153557.144391-6-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210907153557.144391-1-kari.argillander@gmail.com> References: <20210907153557.144391-1-kari.argillander@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org init_fs_context() is meant to initialize s_fs_info (spi). Move spi initializing code there which we can initialize before fill_super(). Signed-off-by: Kari Argillander --- fs/ntfs3/super.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index befa78d3cb26..420cd1409170 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -887,7 +887,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) const struct VOLUME_INFO *info; u32 idx, done, bytes; struct ATTR_DEF_ENTRY *t; - u16 *upcase = NULL; + u16 *upcase; u16 *shared; bool is_ro; struct MFT_REF ref; @@ -902,9 +902,6 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_time_gran = NTFS_TIME_GRAN; // 100 nsec sb->s_xattr = ntfs_xattr_handlers; - ratelimit_state_init(&sbi->msg_ratelimit, DEFAULT_RATELIMIT_INTERVAL, - DEFAULT_RATELIMIT_BURST); - sbi->options->nls = ntfs_load_nls(sbi->options->nls_name); if (IS_ERR(sbi->options->nls)) { sbi->options->nls = NULL; @@ -934,12 +931,6 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_maxbytes = 0xFFFFFFFFull << sbi->cluster_bits; #endif - mutex_init(&sbi->compress.mtx_lznt); -#ifdef CONFIG_NTFS3_LZX_XPRESS - mutex_init(&sbi->compress.mtx_xpress); - mutex_init(&sbi->compress.mtx_lzx); -#endif - /* * Load $Volume. This should be done before $LogFile * 'cause 'sbi->volume.ni' is used 'ntfs_set_state'. @@ -1224,11 +1215,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) goto out; } - sbi->upcase = upcase = kvmalloc(0x10000 * sizeof(short), GFP_KERNEL); - if (!upcase) { - err = -ENOMEM; - goto out; - } + upcase = sbi->upcase; for (idx = 0; idx < (0x10000 * sizeof(short) >> PAGE_SHIFT); idx++) { const __le16 *src; @@ -1440,10 +1427,21 @@ static int ntfs_init_fs_context(struct fs_context *fc) goto ok; sbi = kzalloc(sizeof(struct ntfs_sb_info), GFP_NOFS); - if (!sbi) { - kfree(opts); - return -ENOMEM; - } + if (!sbi) + goto free_opts; + + sbi->upcase = kvmalloc(0x10000 * sizeof(short), GFP_KERNEL); + if (!sbi->upcase) + goto free_sbi; + + ratelimit_state_init(&sbi->msg_ratelimit, DEFAULT_RATELIMIT_INTERVAL, + DEFAULT_RATELIMIT_BURST); + + mutex_init(&sbi->compress.mtx_lznt); +#ifdef CONFIG_NTFS3_LZX_XPRESS + mutex_init(&sbi->compress.mtx_xpress); + mutex_init(&sbi->compress.mtx_lzx); +#endif sbi->options = opts; fc->s_fs_info = sbi; @@ -1452,6 +1450,11 @@ static int ntfs_init_fs_context(struct fs_context *fc) fc->ops = &ntfs_context_ops; return 0; +free_opts: + kfree(opts); +free_sbi: + kfree(sbi); + return -ENOMEM; } // clang-format off -- 2.25.1