From patchwork Thu Jun 14 12:04:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10464047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B7BA7601F9 for ; Thu, 14 Jun 2018 12:05:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8534289EA for ; Thu, 14 Jun 2018 12:05:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CE6828A62; Thu, 14 Jun 2018 12:05:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3979A289EA for ; Thu, 14 Jun 2018 12:05:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755173AbeFNMFK (ORCPT ); Thu, 14 Jun 2018 08:05:10 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:33872 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755147AbeFNMFG (ORCPT ); Thu, 14 Jun 2018 08:05:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=0vF7h7l9hs/1big0yibfJoJ5u5f76VPBUjGSKUu/fxQ=; b=UNSU/Hf9me5CQ172nFBsjPsof 7CXe2c96vYKHTPHPrwbyEjg956RQYjp8g1CpbIWA6KfueGzTRimqrQF4J8MWpBe3sE3FlLj0sgMWr kktq+5sFTH8jVAMpWnUVUSttVtGzv5cwWvu5q9xCS8U9/Sq84ZumeaDNLT+bA4TLHno6i87Inomvn jMAx2YEicIawyNlmevOyLHbbouuFPVf/wf3OhalqcP5F45hZbqUlW+YKHjEgQ0vUAyFrv6k5alvjv 1ETp2bjp87YyurBI5x991nZU7lMltpP7rt+sE4YhOqKFle5EnmovCoZf/Wc+z5460oNgQO7RmKNXa 31alANhDQ==; Received: from 80-109-164-210.cable.dynamic.surfer.at ([80.109.164.210] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fTQzx-0005G4-Gf; Thu, 14 Jun 2018 12:05:05 +0000 From: Christoph Hellwig To: Andreas Gruenbacher , linux-xfs@vger.kernel.org Cc: Dan Williams , linux-fsdevel@vger.kernel.org, cluster-devel@redhat.com, linux-ext4@vger.kernel.org Subject: [PATCH 2/6] iomap: move bdev and dax_dev in a union Date: Thu, 14 Jun 2018 14:04:53 +0200 Message-Id: <20180614120457.28285-3-hch@lst.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180614120457.28285-1-hch@lst.de> References: <20180614120457.28285-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We always either ask for a block device or DAX device mapping, so we can use the same space for both. Signed-off-by: Christoph Hellwig --- fs/ext2/inode.c | 6 ++++-- fs/ext4/inode.c | 6 ++++-- fs/xfs/xfs_iomap.c | 6 ++++-- include/linux/iomap.h | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 71635909df3b..8aead4e9dbc1 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -815,9 +815,11 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length, return ret; iomap->flags = 0; - iomap->bdev = inode->i_sb->s_bdev; iomap->offset = (u64)first_block << blkbits; - iomap->dax_dev = sbi->s_daxdev; + if (IS_DAX(inode)) + iomap->dax_dev = sbi->s_daxdev; + else + iomap->bdev = inode->i_sb->s_bdev; if (ret == 0) { iomap->type = IOMAP_HOLE; diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 2ea07efbe016..79027e99118f 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3524,8 +3524,10 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length, iomap->flags = 0; if (ext4_inode_datasync_dirty(inode)) iomap->flags |= IOMAP_F_DIRTY; - iomap->bdev = inode->i_sb->s_bdev; - iomap->dax_dev = sbi->s_daxdev; + if (IS_DAX(inode)) + iomap->dax_dev = sbi->s_daxdev; + else + iomap->bdev = inode->i_sb->s_bdev; iomap->offset = (u64)first_block << blkbits; iomap->length = (u64)map.m_len << blkbits; diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index c6ce6f9335b6..c9c3d0df5e4c 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -70,8 +70,10 @@ xfs_bmbt_to_iomap( } iomap->offset = XFS_FSB_TO_B(mp, imap->br_startoff); iomap->length = XFS_FSB_TO_B(mp, imap->br_blockcount); - iomap->bdev = xfs_find_bdev_for_inode(VFS_I(ip)); - iomap->dax_dev = xfs_find_daxdev_for_inode(VFS_I(ip)); + if (IS_DAX(VFS_I(ip))) + iomap->dax_dev = xfs_find_daxdev_for_inode(VFS_I(ip)); + else + iomap->bdev = xfs_find_bdev_for_inode(VFS_I(ip)); } xfs_extlen_t diff --git a/include/linux/iomap.h b/include/linux/iomap.h index a044a824da85..212f4d59bcbf 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -53,8 +53,10 @@ struct iomap { u64 length; /* length of mapping, bytes */ u16 type; /* type of mapping */ u16 flags; /* flags for mapping */ - struct block_device *bdev; /* block device for I/O */ - struct dax_device *dax_dev; /* dax_dev for dax operations */ + union { + struct block_device *bdev; + struct dax_device *dax_dev; + }; }; /*