Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp103899pxh; Tue, 9 Nov 2021 07:58:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJz18wn97QTFtPdNVNsFU06DxyNWdO56ff3bNZepx76csaTbCT7wCCUxWRtQwWGbEKpo4Dqj X-Received: by 2002:a17:907:1693:: with SMTP id hc19mr11033338ejc.396.1636473484273; Tue, 09 Nov 2021 07:58:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636473484; cv=none; d=google.com; s=arc-20160816; b=Icu4KuPLPtYjQEd3qU+B13qq54quCda3m0iqkPD7geH3F8reb4oz2h0uHRH0EuHMof 4mcErYI7GC1IxrsDj1qWTQjFPW2Vjj2aBKK5dFDOA5w7OvrTD2vqdaHfqYCmmgc/p0Ez 7fc9AxSX99pGZk4G1KAtIJgUpmdu+ee++kNLAI0Xe6ReUa3yaoV17mStT6R2vXFK9D19 R0DnBKKQypvcYjWIhZ5oljabg6T82/vZllLSZ6yPB3zvoeP7KsE2467OHIPm+/u8C6A7 q7XMO60eAMeK/Bi3Mqq+PM96hVZmyz7UHt+zv7BnVvYmHCBFw4xLrRHQjnl85KwkjhZK UM7A== 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=+scVZaxx4kcvp0Cboq1Z7TDSMt9zURLxK3cUHRmeCJY=; b=0TjkkYPSVmN3e70OnHwK6KGYScZBS1e1eZFBzlVrvHdDBbE08sVsARbVIJwEwBAuwP 4gE1mbVz4X3e6ZJHlg/CYUxnmm/FiGC1bMFy1b9++V94ueK88EwITr1pDglH+KI7DISw 9gGaq/Vap3pGbFkVnkSavJoxb8xMiAlFJD5V74xNireOj/JSQ63MpyXAdqWXjxgzSBcI wFH4/nQMy5THsK7YhqsgHdT5dyNpNLH8i6S4vpri3gAuS70hOc+BC/8CjrTI+rqvj/OH ON0WUaa01iA6fDSCLXheaDWuE67w+3bomrQzpmOhiR4tTQibpPhpD/MNs/sJXj0DUvp+ UDxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=TVkdImeU; 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 a16si21065897eda.436.2021.11.09.07.57.37; Tue, 09 Nov 2021 07:58:04 -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=TVkdImeU; 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 S244240AbhKIIgm (ORCPT + 99 others); Tue, 9 Nov 2021 03:36:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244234AbhKIIgl (ORCPT ); Tue, 9 Nov 2021 03:36:41 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11C71C061764; Tue, 9 Nov 2021 00:33:55 -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=+scVZaxx4kcvp0Cboq1Z7TDSMt9zURLxK3cUHRmeCJY=; b=TVkdImeUmftPM79g0PQhq20Ta/ RuxJyo/av4rpO9uxXtuLKWWoEXVONWEOL7vNvV5s8fmK01QKc9v6zFnOGpWQ8veO3PW41Veas6UZd 7vhJhKrargNEMiZSeZbpl5goXtJhQ1blmw3uTTLPOrnp4Ylr6Mkbdrwjsy2aUO2KGzReNWaN7T1RT 1vs5j3lyh+OmWzCpqYO62KgdQupFc3i8JBAmq1ShrHT1uqi9w8d7WcG88O26dMVcPidYVh2zNjS3K Y3ydrmz/SGcOgWBJAkmvOjEGIncW+Ke5rV/nj/tmVsx9UIkM/+3rpVyE4E6+uyOWiKc8zys52VYQe 9itJrl+Q==; 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 1mkMZh-000s7y-MB; Tue, 09 Nov 2021 08:33:50 +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 21/29] xfs: move dax device handling into xfs_{alloc,free}_buftarg Date: Tue, 9 Nov 2021 09:33:01 +0100 Message-Id: <20211109083309.584081-22-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 Hide the DAX device lookup from the xfs_super.c code. Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_buf.c | 8 ++++---- fs/xfs/xfs_buf.h | 4 ++-- fs/xfs/xfs_super.c | 26 +++++--------------------- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 631c5a61d89b7..4d4553ffa7050 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1892,6 +1892,7 @@ xfs_free_buftarg( list_lru_destroy(&btp->bt_lru); blkdev_issue_flush(btp->bt_bdev); + fs_put_dax(btp->bt_daxdev); kmem_free(btp); } @@ -1932,11 +1933,10 @@ xfs_setsize_buftarg_early( return xfs_setsize_buftarg(btp, bdev_logical_block_size(bdev)); } -xfs_buftarg_t * +struct xfs_buftarg * xfs_alloc_buftarg( struct xfs_mount *mp, - struct block_device *bdev, - struct dax_device *dax_dev) + struct block_device *bdev) { xfs_buftarg_t *btp; @@ -1945,7 +1945,7 @@ xfs_alloc_buftarg( btp->bt_mount = mp; btp->bt_dev = bdev->bd_dev; btp->bt_bdev = bdev; - btp->bt_daxdev = dax_dev; + btp->bt_daxdev = fs_dax_get_by_bdev(bdev); /* * Buffer IO error rate limiting. Limit it to no more than 10 messages diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index 6b0200b8007d1..bd7f709f0d232 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h @@ -338,8 +338,8 @@ xfs_buf_update_cksum(struct xfs_buf *bp, unsigned long cksum_offset) /* * Handling of buftargs. */ -extern struct xfs_buftarg *xfs_alloc_buftarg(struct xfs_mount *, - struct block_device *, struct dax_device *); +struct xfs_buftarg *xfs_alloc_buftarg(struct xfs_mount *mp, + struct block_device *bdev); extern void xfs_free_buftarg(struct xfs_buftarg *); extern void xfs_buftarg_wait(struct xfs_buftarg *); extern void xfs_buftarg_drain(struct xfs_buftarg *); diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 3a45d5caa28d5..7262716afb215 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -391,26 +391,19 @@ STATIC void xfs_close_devices( struct xfs_mount *mp) { - struct dax_device *dax_ddev = mp->m_ddev_targp->bt_daxdev; - if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { struct block_device *logdev = mp->m_logdev_targp->bt_bdev; - struct dax_device *dax_logdev = mp->m_logdev_targp->bt_daxdev; xfs_free_buftarg(mp->m_logdev_targp); xfs_blkdev_put(logdev); - fs_put_dax(dax_logdev); } if (mp->m_rtdev_targp) { struct block_device *rtdev = mp->m_rtdev_targp->bt_bdev; - struct dax_device *dax_rtdev = mp->m_rtdev_targp->bt_daxdev; xfs_free_buftarg(mp->m_rtdev_targp); xfs_blkdev_put(rtdev); - fs_put_dax(dax_rtdev); } xfs_free_buftarg(mp->m_ddev_targp); - fs_put_dax(dax_ddev); } /* @@ -428,8 +421,6 @@ xfs_open_devices( struct xfs_mount *mp) { struct block_device *ddev = mp->m_super->s_bdev; - struct dax_device *dax_ddev = fs_dax_get_by_bdev(ddev); - struct dax_device *dax_logdev = NULL, *dax_rtdev = NULL; struct block_device *logdev = NULL, *rtdev = NULL; int error; @@ -439,8 +430,7 @@ xfs_open_devices( if (mp->m_logname) { error = xfs_blkdev_get(mp, mp->m_logname, &logdev); if (error) - goto out; - dax_logdev = fs_dax_get_by_bdev(logdev); + return error; } if (mp->m_rtname) { @@ -454,25 +444,24 @@ xfs_open_devices( error = -EINVAL; goto out_close_rtdev; } - dax_rtdev = fs_dax_get_by_bdev(rtdev); } /* * Setup xfs_mount buffer target pointers */ error = -ENOMEM; - mp->m_ddev_targp = xfs_alloc_buftarg(mp, ddev, dax_ddev); + mp->m_ddev_targp = xfs_alloc_buftarg(mp, ddev); if (!mp->m_ddev_targp) goto out_close_rtdev; if (rtdev) { - mp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev, dax_rtdev); + mp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev); if (!mp->m_rtdev_targp) goto out_free_ddev_targ; } if (logdev && logdev != ddev) { - mp->m_logdev_targp = xfs_alloc_buftarg(mp, logdev, dax_logdev); + mp->m_logdev_targp = xfs_alloc_buftarg(mp, logdev); if (!mp->m_logdev_targp) goto out_free_rtdev_targ; } else { @@ -488,14 +477,9 @@ xfs_open_devices( xfs_free_buftarg(mp->m_ddev_targp); out_close_rtdev: xfs_blkdev_put(rtdev); - fs_put_dax(dax_rtdev); out_close_logdev: - if (logdev && logdev != ddev) { + if (logdev && logdev != ddev) xfs_blkdev_put(logdev); - fs_put_dax(dax_logdev); - } - out: - fs_put_dax(dax_ddev); return error; } -- 2.30.2