linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	cluster-devel <cluster-devel@redhat.com>,
	linux-ext4 <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 2/6] iomap: move bdev and dax_dev in a union
Date: Wed, 6 Jun 2018 13:37:02 +0200	[thread overview]
Message-ID: <CAHc6FU5xFMmN1EPGrZOhx9S5Focwq0Ky9HZeQ9VRGFC-o-cZZw@mail.gmail.com> (raw)
In-Reply-To: <20180606104033.4947-3-hch@lst.de>

On 6 June 2018 at 12:40, Christoph Hellwig <hch@lst.de> wrote:
> 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 <hch@lst.de>
> ---
>  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..587110db1ad2 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->bdev = xfs_find_bdev_for_inode(VFS_I(ip));
> +       else
> +               iomap->dax_dev = xfs_find_daxdev_for_inode(VFS_I(ip));

This seems backwards.

>  }
>
>  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;
> +       };
>  };
>
>  /*
> --
> 2.14.2
>

Andreas

  reply	other threads:[~2018-06-06 11:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06 10:40 iomap preparations for GFS2 Christoph Hellwig
2018-06-06 10:40 ` [PATCH 1/6] fs: factor out a __generic_write_end helper Christoph Hellwig
2018-06-06 10:59   ` Christoph Hellwig
2018-06-06 11:09     ` Andreas Grünbacher
2018-06-06 10:40 ` [PATCH 2/6] iomap: move bdev and dax_dev in a union Christoph Hellwig
2018-06-06 11:37   ` Andreas Gruenbacher [this message]
2018-06-06 12:05     ` Christoph Hellwig
2018-06-06 10:40 ` [PATCH 3/6] iomap: mark newly allocated buffer heads as new Christoph Hellwig
2018-06-06 10:40 ` [PATCH 4/6] iomap: complete partial direct I/O writes synchronously Christoph Hellwig
2018-06-06 10:40 ` [PATCH 5/6] iomap: generic inline data handling Christoph Hellwig
2018-06-07 13:50   ` Andreas Grünbacher
2018-06-06 10:40 ` [PATCH 6/6] iomap: add a page_done callback Christoph Hellwig
2018-06-06 11:37   ` Andreas Gruenbacher
2018-06-06 11:38 ` iomap preparations for GFS2 Andreas Gruenbacher
2018-06-06 15:31   ` Andreas Grünbacher
2018-06-06 15:39     ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2018-06-14 12:04 iomap preparations for GFS2 v2 Christoph Hellwig
2018-06-14 12:04 ` [PATCH 2/6] iomap: move bdev and dax_dev in a union Christoph Hellwig
2018-06-19  6:25   ` Darrick J. Wong
2018-06-19  6:44     ` Christoph Hellwig
2018-06-19  6:50       ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHc6FU5xFMmN1EPGrZOhx9S5Focwq0Ky9HZeQ9VRGFC-o-cZZw@mail.gmail.com \
    --to=agruenba@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=hch@lst.de \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).