From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BAF83FD5 for ; Mon, 29 Nov 2021 10:22:42 +0000 (UTC) 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=CHX+n6oDrTWr4Nl3g7rdBdOryWfotdrK7gxEyyupiQA=; b=QV/FtrIwDrWha7Vur1aJccAM72 ZgAFG0bkaPiwkrKZnFahQVqskCV0kd/W+yTVp0f4tQEZLbixhzP3Mx36E5fxtY8dkFwGN2VQ01vbP FEoGdvlZObHVsGoO+GSosoly0LRkB1rsN4Myoau0YzNeey3RCxVA/cF0nbJZ6r8g1hdRReA2ASMc1 qDRZ71Tpn1tz9sO9eA5MRWXFQLMeuefo/I8zs2AjNZ/IJZLMPa/p1/1bnLXij9kP6s1T3Ar+P1S5X MI0FoN8GY/G+7NS1/nh7Gsn9OSHDz/0RV4RNyB5lJUw/DrroYCJ8FKNOReVDfAGg9PYYWKg0ubhp1 hRtN8o7Q==; Received: from [2001:4bb8:184:4a23:724a:c057:c7bf:4643] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mrdnr-0073T8-He; Mon, 29 Nov 2021 10:22:32 +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, "Darrick J . Wong" Subject: [PATCH 20/29] ext4: cleanup the dax handling in ext4_fill_super Date: Mon, 29 Nov 2021 11:21:54 +0100 Message-Id: <20211129102203.2243509-21-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211129102203.2243509-1-hch@lst.de> References: <20211129102203.2243509-1-hch@lst.de> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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 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 Reviewed-by: Dan Williams Reviewed-by: Darrick J. Wong --- fs/ext4/super.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index fd3d68f10ee55..8d7e3449c6472 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3878,7 +3878,6 @@ static void ext4_setup_csum_trigger(struct super_block *sb, static int ext4_fill_super(struct super_block *sb, void *data, int silent) { - struct dax_device *dax_dev = fs_dax_get_by_bdev(sb->s_bdev); char *orig_data = kstrdup(data, GFP_KERNEL); struct buffer_head *bh, **group_desc; struct ext4_super_block *es = NULL; @@ -3909,12 +3908,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) if ((data && !orig_data) || !sbi) goto out_free_base; - sbi->s_daxdev = dax_dev; sbi->s_blockgroup_lock = kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL); if (!sbi->s_blockgroup_lock) goto out_free_base; + sbi->s_daxdev = fs_dax_get_by_bdev(sb->s_bdev); sb->s_fs_info = sbi; sbi->s_sb = sb; sbi->s_inode_readahead_blks = EXT4_DEF_INODE_READAHEAD_BLKS; @@ -4299,7 +4298,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) goto failed_mount; } - if (dax_dev) { + if (sbi->s_daxdev) { if (blocksize == PAGE_SIZE) set_bit(EXT4_FLAGS_BDEV_IS_DAX, &sbi->s_ext4_flags); else @@ -5095,10 +5094,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) out_fail: sb->s_fs_info = NULL; kfree(sbi->s_blockgroup_lock); + fs_put_dax(sbi->s_daxdev); out_free_base: kfree(sbi); kfree(orig_data); - fs_put_dax(dax_dev); return err ? err : ret; } -- 2.30.2