Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp104175pxh; Tue, 9 Nov 2021 07:58:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyIWBXPn7SR2szOxHf+AOIOZ16vfzLUrV0qJgpDOFVwPRjmslfmAyFeJE5b3G8esjFM9BK3 X-Received: by 2002:a17:906:140b:: with SMTP id p11mr10688473ejc.116.1636473500430; Tue, 09 Nov 2021 07:58:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636473500; cv=none; d=google.com; s=arc-20160816; b=LjyPAGvnEnybBSUgbDKDi0c1Z7MbDzzyuqa0K1Pw8NSw0dc0l3v7znl5aHgpX3YcoN MOe8mGXu92eeXDoOp6WSq2aGakoxvLpmuuZf5s+kE4OlW2qw+6sTaTB0utd3jgfEg+K0 oIYiU2t5TdcC64OEaD8lEerxlr0H+OVAhZ94C5+QqugU6AjXSYzs8QigXeWBxcInAoF1 AhjTf07V9vaVhB49HKH53fMKqbgKYuwmvU1NRmorrjC7eY7LBhBvSo1GybqjYv8lCyHv UyH0qHbib2xXZUsnUleTwg1At2P0nGnAFAaMpBCWjjy/lVzdSmvEtNtQOMRO/fORVtHa PrOw== 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=w7OlGcun90+irmAPYzmTcZBOPYBcRc9XENfZ6+Mb9vU=; b=CzRplcPTpuYUO3sEChCdZ/Ncuq6vgtKt6Xdduc5jE/uD8LVbUGIZKMRv9MLstbjXAT ZGulcu+xZD4/IcKmj5snsOxM5xHsb+jIBfs8WPq8I185kLpq62Oi5xXxP9MeC63xr7TO dSj3qgRsA+EtmqEt7al6KPrgHVfJ/fV0ZXMseqIBJ+7wydW9sDZCot2gP7fx0OSyeTVC w8yeH9h3Ob1K6ut6NZrbMK3JvGbi0VBAuvPDVO2GoKjSVzzEV8EFb7/4n2yLksJJoZ6U Y/euzfJfU6UEkzjC/TD/q6lfuTCKe6Pc8Yb2WOLFtQDcOGeKEPFkL2Vt469iNxbe9NmL WrAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=jWJH7gRa; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e7si7081250edk.440.2021.11.09.07.57.56; Tue, 09 Nov 2021 07:58:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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=@infradead.org header.s=casper.20170209 header.b=jWJH7gRa; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244219AbhKIIgo (ORCPT + 99 others); Tue, 9 Nov 2021 03:36:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244215AbhKIIgh (ORCPT ); Tue, 9 Nov 2021 03:36:37 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18D96C061766; Tue, 9 Nov 2021 00:33:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=w7OlGcun90+irmAPYzmTcZBOPYBcRc9XENfZ6+Mb9vU=; b=jWJH7gRabA1nTyzMlvOyrMmL6A d1snCm4OAtdG9l96Fl8SdKPajWndw2wLlbGdJcqzIZuESJlOdHsiUq58YLz9LH9Mlp11mSyTq/37f Gi5Fa9czKxgBGgLurjuhXBCqhQIk4HYDrJnbGc3S00AjlhI2SdXjzPkKbqK8qebbUvMI1X9wwVq1t f0JNoiiUP0y6wny2CDC5c6gmSjssHyPwLn85K617F9BzrxUekruJ3zUtV7YSU7uoqQs4ZIlHoyAFH JXb42BtJPPQnrHsObmA6aGnKjFyz7ZK36uY2Eok7JXO3qbtMsmSl0/btVmQrUctSho4PyptJVK4HM KAEOcvJw==; Received: from [2001:4bb8:19a:7ee7:fb46:2fe1:8652:d9d4] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkMZe-000s6P-H3; Tue, 09 Nov 2021 08:33:47 +0000 From: Christoph Hellwig To: Dan Williams Cc: Mike Snitzer , Ira Weiny , dm-devel@redhat.com, linux-xfs@vger.kernel.org, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH 19/29] ext2: cleanup the dax handling in ext2_fill_super Date: Tue, 9 Nov 2021 09:32:59 +0100 Message-Id: <20211109083309.584081-20-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211109083309.584081-1-hch@lst.de> References: <20211109083309.584081-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Only call fs_dax_get_by_bdev once the sbi has been allocated and remove the need for the dax_dev local variable. Signed-off-by: Christoph Hellwig --- fs/ext2/super.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/ext2/super.c b/fs/ext2/super.c index a964066a80aa7..7e23482862e69 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -802,7 +802,6 @@ static unsigned long descriptor_loc(struct super_block *sb, static int ext2_fill_super(struct super_block *sb, void *data, int silent) { - struct dax_device *dax_dev = fs_dax_get_by_bdev(sb->s_bdev); struct buffer_head * bh; struct ext2_sb_info * sbi; struct ext2_super_block * es; @@ -822,17 +821,17 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); if (!sbi) - goto failed; + return -ENOMEM; sbi->s_blockgroup_lock = kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL); if (!sbi->s_blockgroup_lock) { kfree(sbi); - goto failed; + return -ENOMEM; } sb->s_fs_info = sbi; sbi->s_sb_block = sb_block; - sbi->s_daxdev = dax_dev; + sbi->s_daxdev = fs_dax_get_by_bdev(sb->s_bdev); spin_lock_init(&sbi->s_lock); ret = -EINVAL; @@ -946,7 +945,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); if (test_opt(sb, DAX)) { - if (!dax_dev) { + if (!sbi->s_daxdev) { ext2_msg(sb, KERN_ERR, "DAX unsupported by block device. Turning off DAX."); clear_opt(sbi->s_mount_opt, DAX); @@ -1201,11 +1200,10 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) failed_mount: brelse(bh); failed_sbi: + fs_put_dax(sbi->s_daxdev); sb->s_fs_info = NULL; kfree(sbi->s_blockgroup_lock); kfree(sbi); -failed: - fs_put_dax(dax_dev); return ret; } -- 2.30.2