diff mbox series

[8/9] xfs: factor out a xfs_buftarg_is_dax helper

Message ID 20210826135510.6293-9-hch@lst.de
State Not Applicable
Headers show
Series [1/9] fsdax: improve the FS_DAX Kconfig description and help text | expand

Commit Message

Christoph Hellwig Aug. 26, 2021, 1:55 p.m. UTC
Refactor the DAX setup code in preparation of removing
bdev_dax_supported.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
---
 fs/xfs/xfs_super.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Comments

Dan Williams Aug. 26, 2021, 2:37 p.m. UTC | #1
[ add Darrick ]


On Thu, Aug 26, 2021 at 7:07 AM Christoph Hellwig <hch@lst.de> wrote:
>
> Refactor the DAX setup code in preparation of removing
> bdev_dax_supported.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  fs/xfs/xfs_super.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)

Darrick, any concerns with me taking this through the dax tree?

>
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 2c9e26a44546..5a89bf601d97 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -314,6 +314,14 @@ xfs_set_inode_alloc(
>         return (mp->m_flags & XFS_MOUNT_32BITINODES) ? maxagi : agcount;
>  }
>
> +static bool
> +xfs_buftarg_is_dax(
> +       struct super_block      *sb,
> +       struct xfs_buftarg      *bt)
> +{
> +       return bdev_dax_supported(bt->bt_bdev, sb->s_blocksize);
> +}
> +
>  STATIC int
>  xfs_blkdev_get(
>         xfs_mount_t             *mp,
> @@ -1549,11 +1557,10 @@ xfs_fs_fill_super(
>                 xfs_warn(mp,
>                 "DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
>
> -               datadev_is_dax = bdev_dax_supported(mp->m_ddev_targp->bt_bdev,
> -                       sb->s_blocksize);
> +               datadev_is_dax = xfs_buftarg_is_dax(sb, mp->m_ddev_targp);
>                 if (mp->m_rtdev_targp)
> -                       rtdev_is_dax = bdev_dax_supported(
> -                               mp->m_rtdev_targp->bt_bdev, sb->s_blocksize);
> +                       rtdev_is_dax = xfs_buftarg_is_dax(sb,
> +                                               mp->m_rtdev_targp);
>                 if (!rtdev_is_dax && !datadev_is_dax) {
>                         xfs_alert(mp,
>                         "DAX unsupported by block device. Turning off DAX.");
> --
> 2.30.2
>
>
Darrick J. Wong Aug. 26, 2021, 3:11 p.m. UTC | #2
On Thu, Aug 26, 2021 at 07:37:29AM -0700, Dan Williams wrote:
> [ add Darrick ]
> 
> 
> On Thu, Aug 26, 2021 at 7:07 AM Christoph Hellwig <hch@lst.de> wrote:
> >
> > Refactor the DAX setup code in preparation of removing
> > bdev_dax_supported.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > Reviewed-by: Dan Williams <dan.j.williams@intel.com>
> > ---
> >  fs/xfs/xfs_super.c | 15 +++++++++++----
> >  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> Darrick, any concerns with me taking this through the dax tree?

Nope.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> 
> >
> > diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> > index 2c9e26a44546..5a89bf601d97 100644
> > --- a/fs/xfs/xfs_super.c
> > +++ b/fs/xfs/xfs_super.c
> > @@ -314,6 +314,14 @@ xfs_set_inode_alloc(
> >         return (mp->m_flags & XFS_MOUNT_32BITINODES) ? maxagi : agcount;
> >  }
> >
> > +static bool
> > +xfs_buftarg_is_dax(
> > +       struct super_block      *sb,
> > +       struct xfs_buftarg      *bt)
> > +{
> > +       return bdev_dax_supported(bt->bt_bdev, sb->s_blocksize);
> > +}
> > +
> >  STATIC int
> >  xfs_blkdev_get(
> >         xfs_mount_t             *mp,
> > @@ -1549,11 +1557,10 @@ xfs_fs_fill_super(
> >                 xfs_warn(mp,
> >                 "DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
> >
> > -               datadev_is_dax = bdev_dax_supported(mp->m_ddev_targp->bt_bdev,
> > -                       sb->s_blocksize);
> > +               datadev_is_dax = xfs_buftarg_is_dax(sb, mp->m_ddev_targp);
> >                 if (mp->m_rtdev_targp)
> > -                       rtdev_is_dax = bdev_dax_supported(
> > -                               mp->m_rtdev_targp->bt_bdev, sb->s_blocksize);
> > +                       rtdev_is_dax = xfs_buftarg_is_dax(sb,
> > +                                               mp->m_rtdev_targp);
> >                 if (!rtdev_is_dax && !datadev_is_dax) {
> >                         xfs_alert(mp,
> >                         "DAX unsupported by block device. Turning off DAX.");
> > --
> > 2.30.2
> >
> >
diff mbox series

Patch

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 2c9e26a44546..5a89bf601d97 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -314,6 +314,14 @@  xfs_set_inode_alloc(
 	return (mp->m_flags & XFS_MOUNT_32BITINODES) ? maxagi : agcount;
 }
 
+static bool
+xfs_buftarg_is_dax(
+	struct super_block	*sb,
+	struct xfs_buftarg	*bt)
+{
+	return bdev_dax_supported(bt->bt_bdev, sb->s_blocksize);
+}
+
 STATIC int
 xfs_blkdev_get(
 	xfs_mount_t		*mp,
@@ -1549,11 +1557,10 @@  xfs_fs_fill_super(
 		xfs_warn(mp,
 		"DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
 
-		datadev_is_dax = bdev_dax_supported(mp->m_ddev_targp->bt_bdev,
-			sb->s_blocksize);
+		datadev_is_dax = xfs_buftarg_is_dax(sb, mp->m_ddev_targp);
 		if (mp->m_rtdev_targp)
-			rtdev_is_dax = bdev_dax_supported(
-				mp->m_rtdev_targp->bt_bdev, sb->s_blocksize);
+			rtdev_is_dax = xfs_buftarg_is_dax(sb,
+						mp->m_rtdev_targp);
 		if (!rtdev_is_dax && !datadev_is_dax) {
 			xfs_alert(mp,
 			"DAX unsupported by block device. Turning off DAX.");