diff mbox

[8/8] xfs: add initial DAX support

Message ID 1427194266-2885-9-git-send-email-david@fromorbit.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dave Chinner March 24, 2015, 10:51 a.m. UTC
From: Dave Chinner <dchinner@redhat.com>

Add initial DAX support to XFS. To do this we need a new mount
option to turn DAX on filesystem, and we need to propagate thi into
the inode flags whenever an inode is instantiated so that the
per-inode checks throughout the code Do The Right Thing.

There are still some things remaining to be done:

	- needs per-inode flags to mark inodes as DAX enabled, and
	  an inheritance flag to enable automatic filesystem
	  propagation of the property
	- fails occasionally with zero length writes instead of
	  ENOSPC errors, so error propagation inside/from the DAX
	  code need work
	- occasionally creates two extents rather than a single
	  larger extent like non-dax filesystems.
	- much more testing

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 fs/xfs/xfs_iops.c  | 24 ++++++++++++------------
 fs/xfs/xfs_mount.h |  2 ++
 fs/xfs/xfs_super.c | 25 +++++++++++++++++++++++--
 3 files changed, 37 insertions(+), 14 deletions(-)

Comments

Boaz Harrosh March 24, 2015, 12:52 p.m. UTC | #1
On 03/24/2015 12:51 PM, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> Add initial DAX support to XFS. To do this we need a new mount
> option to turn DAX on filesystem, and we need to propagate thi into
> the inode flags whenever an inode is instantiated so that the
> per-inode checks throughout the code Do The Right Thing.
> 
> There are still some things remaining to be done:
> 
> 	- needs per-inode flags to mark inodes as DAX enabled, and
> 	  an inheritance flag to enable automatic filesystem
> 	  propagation of the property
> 	- fails occasionally with zero length writes instead of
> 	  ENOSPC errors, so error propagation inside/from the DAX
> 	  code need work
> 	- occasionally creates two extents rather than a single
> 	  larger extent like non-dax filesystems.
> 	- much more testing
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
>  fs/xfs/xfs_iops.c  | 24 ++++++++++++------------
>  fs/xfs/xfs_mount.h |  2 ++
>  fs/xfs/xfs_super.c | 25 +++++++++++++++++++++++--
>  3 files changed, 37 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 9ca5352..695d857 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -1195,22 +1195,22 @@ xfs_diflags_to_iflags(
>  	struct inode		*inode,
>  	struct xfs_inode	*ip)
>  {
> -	if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE)
> +	uint16_t		flags = ip->i_d.di_flags;
> +
> +	inode->i_flags &= ~(S_IMMUTABLE | S_APPEND | S_SYNC |
> +			    S_NOATIME | S_DAX);
> +
> +	if (flags & XFS_DIFLAG_IMMUTABLE)
>  		inode->i_flags |= S_IMMUTABLE;
> -	else
> -		inode->i_flags &= ~S_IMMUTABLE;
> -	if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)
> +	if (flags & XFS_DIFLAG_APPEND)
>  		inode->i_flags |= S_APPEND;
> -	else
> -		inode->i_flags &= ~S_APPEND;
> -	if (ip->i_d.di_flags & XFS_DIFLAG_SYNC)
> +	if (flags & XFS_DIFLAG_SYNC)
>  		inode->i_flags |= S_SYNC;
> -	else
> -		inode->i_flags &= ~S_SYNC;
> -	if (ip->i_d.di_flags & XFS_DIFLAG_NOATIME)
> +	if (flags & XFS_DIFLAG_NOATIME)
>  		inode->i_flags |= S_NOATIME;
> -	else
> -		inode->i_flags &= ~S_NOATIME;
> +	/* XXX: Also needs an on-disk per inode flag! */
> +	if (ip->i_mount->m_flags & XFS_MOUNT_DAX)
> +		inode->i_flags |= S_DAX;
>  }
>  
>  /*
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index 8c995a2..cd44e88 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -179,6 +179,8 @@ typedef struct xfs_mount {
>  						   allocator */
>  #define XFS_MOUNT_NOATTR2	(1ULL << 25)	/* disable use of attr2 format */
>  
> +#define XFS_MOUNT_DAX		(1ULL << 62)	/* TEST ONLY! */
> +
>  
>  /*
>   * Default minimum read and write sizes.
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 3ad0b17..0f26d7a 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -112,6 +112,8 @@ static struct xfs_kobj xfs_dbg_kobj;	/* global debug sysfs attrs */
>  #define MNTOPT_DISCARD	   "discard"	/* Discard unused blocks */
>  #define MNTOPT_NODISCARD   "nodiscard"	/* Do not discard unused blocks */
>  
> +#define MNTOPT_DAX	"dax"		/* Enable direct access to bdev pages */
> +
>  /*
>   * Table driven mount option parser.
>   *
> @@ -363,6 +365,10 @@ xfs_parseargs(
>  			mp->m_flags |= XFS_MOUNT_DISCARD;
>  		} else if (!strcmp(this_char, MNTOPT_NODISCARD)) {
>  			mp->m_flags &= ~XFS_MOUNT_DISCARD;
> +#ifdef CONFIG_FS_DAX
> +		} else if (!strcmp(this_char, MNTOPT_DAX)) {
> +			mp->m_flags |= XFS_MOUNT_DAX;

Hi

So what I see, (I might be wrong), is that once this flag is set here the
fs (At above xfs_diflags_to_iflags() ) will start serving DAX inodes.

This is a problem because the bdev passed in might not support direct_access
at all.

I think we might want a dax_supported(sb) and call somewhere at mount time.

> +#endif
>  		} else {
>  			xfs_warn(mp, "unknown mount option [%s].", this_char);
>  			return -EINVAL;
> @@ -452,8 +458,8 @@ done:
>  }
>  
>  struct proc_xfs_info {
> -	int	flag;
> -	char	*str;
> +	uint64_t	flag;
> +	char		*str;
>  };
>  
>  STATIC int
> @@ -474,6 +480,7 @@ xfs_showargs(
>  		{ XFS_MOUNT_GRPID,		"," MNTOPT_GRPID },
>  		{ XFS_MOUNT_DISCARD,		"," MNTOPT_DISCARD },
>  		{ XFS_MOUNT_SMALL_INUMS,	"," MNTOPT_32BITINODE },
> +		{ XFS_MOUNT_DAX,		"," MNTOPT_DAX },
>  		{ 0, NULL }
>  	};
>  	static struct proc_xfs_info xfs_info_unset[] = {
> @@ -1501,6 +1508,20 @@ xfs_fs_fill_super(
>  	if (XFS_SB_VERSION_NUM(&mp->m_sb) == XFS_SB_VERSION_5)
>  		sb->s_flags |= MS_I_VERSION;
>  
> +	if (mp->m_flags & XFS_MOUNT_DAX) {
> +		xfs_warn(mp,
> +	"DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
> +		if (sb->s_blocksize != PAGE_SIZE) {
> +			xfs_alert(mp,
> +		"Filesystem block size invalid for DAX Turning DAX off.");
> +			mp->m_flags &= ~XFS_MOUNT_DAX;
> +		} else if (!sb->s_bdev->bd_disk->fops->direct_access) {
> +			xfs_alert(mp,
> +		"Block device does not support DAX Turning DAX off.");
> +			mp->m_flags &= ~XFS_MOUNT_DAX;
> +		}
> +	}
> 

If we agree about the s_flags MS_MOUNT_DAX  then we can define a
	if (MNTOPT_DAX)
		dax_enable_if_supported(sb);

This will try a call to bdev_direct_access(sb->s_bdev, ...) and set the
flag if everything is OK, else will leave it off.

(I can do this patch if you want)

>  	error = xfs_mountfs(mp);
>  	if (error)
>  		goto out_filestream_unmount;
> 

Thanks
Boaz

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dave Chinner March 24, 2015, 9:25 p.m. UTC | #2
On Tue, Mar 24, 2015 at 02:52:48PM +0200, Boaz Harrosh wrote:
> On 03/24/2015 12:51 PM, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > @@ -363,6 +365,10 @@ xfs_parseargs(
> >  			mp->m_flags |= XFS_MOUNT_DISCARD;
> >  		} else if (!strcmp(this_char, MNTOPT_NODISCARD)) {
> >  			mp->m_flags &= ~XFS_MOUNT_DISCARD;
> > +#ifdef CONFIG_FS_DAX
> > +		} else if (!strcmp(this_char, MNTOPT_DAX)) {
> > +			mp->m_flags |= XFS_MOUNT_DAX;
> 
> Hi
> 
> So what I see, (I might be wrong), is that once this flag is set here the
> fs (At above xfs_diflags_to_iflags() ) will start serving DAX inodes.

No, it won't, because...

> > @@ -1501,6 +1508,20 @@ xfs_fs_fill_super(
> >  	if (XFS_SB_VERSION_NUM(&mp->m_sb) == XFS_SB_VERSION_5)
> >  		sb->s_flags |= MS_I_VERSION;
> >  
> > +	if (mp->m_flags & XFS_MOUNT_DAX) {
> > +		xfs_warn(mp,
> > +	"DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
> > +		if (sb->s_blocksize != PAGE_SIZE) {
> > +			xfs_alert(mp,
> > +		"Filesystem block size invalid for DAX Turning DAX off.");
> > +			mp->m_flags &= ~XFS_MOUNT_DAX;
> > +		} else if (!sb->s_bdev->bd_disk->fops->direct_access) {
> > +			xfs_alert(mp,
> > +		"Block device does not support DAX Turning DAX off.");
> > +			mp->m_flags &= ~XFS_MOUNT_DAX;
> > +		}
> > +	}

We run these tests and then clear the XFS_MOUNT_DAX flag later.

> If we agree about the s_flags MS_MOUNT_DAX  then we can define a
> 	if (MNTOPT_DAX)
> 		dax_enable_if_supported(sb);

No, I don't see any reason for a mount flag for this, because we
do not want to be stuck relying on a mount option forever. Once
This code has been shaken out, I fully intend DAX to be turned on
automatically for any device that supports, and for it to be turned
on and off on a per-inode basis through on-disk inode flags. i.e.
the mount option is really a temporary solution and I don't want to
code in any dependencies on DAX being mount wide existing.

Cheers,

Dave.
Boaz Harrosh March 25, 2015, 9:14 a.m. UTC | #3
On 03/24/2015 11:25 PM, Dave Chinner wrote:
<>
> 
> No, I don't see any reason for a mount flag for this, because we
> do not want to be stuck relying on a mount option forever. Once
> This code has been shaken out, I fully intend DAX to be turned on
> automatically for any device that supports, and for it to be turned
> on and off on a per-inode basis through on-disk inode flags. i.e.
> the mount option is really a temporary solution and I don't want to
> code in any dependencies on DAX being mount wide existing.
> 

OK I dropped this flag. I will just check for the direct_access
vector. I'll need a wrapper that defines to nothing in the
!CONFIG_FS_DAX case

> Cheers,
> Dave.
> 

Thanks for your help
Boaz

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Brian Foster April 6, 2015, 7 p.m. UTC | #4
On Tue, Mar 24, 2015 at 09:51:06PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> Add initial DAX support to XFS. To do this we need a new mount
> option to turn DAX on filesystem, and we need to propagate thi into
> the inode flags whenever an inode is instantiated so that the
> per-inode checks throughout the code Do The Right Thing.
> 
> There are still some things remaining to be done:
> 
> 	- needs per-inode flags to mark inodes as DAX enabled, and
> 	  an inheritance flag to enable automatic filesystem
> 	  propagation of the property
> 	- fails occasionally with zero length writes instead of
> 	  ENOSPC errors, so error propagation inside/from the DAX
> 	  code need work
> 	- occasionally creates two extents rather than a single
> 	  larger extent like non-dax filesystems.
> 	- much more testing
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
>  fs/xfs/xfs_iops.c  | 24 ++++++++++++------------
>  fs/xfs/xfs_mount.h |  2 ++
>  fs/xfs/xfs_super.c | 25 +++++++++++++++++++++++--
>  3 files changed, 37 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 9ca5352..695d857 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -1195,22 +1195,22 @@ xfs_diflags_to_iflags(
>  	struct inode		*inode,
>  	struct xfs_inode	*ip)
>  {
> -	if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE)
> +	uint16_t		flags = ip->i_d.di_flags;
> +
> +	inode->i_flags &= ~(S_IMMUTABLE | S_APPEND | S_SYNC |
> +			    S_NOATIME | S_DAX);
> +
> +	if (flags & XFS_DIFLAG_IMMUTABLE)
>  		inode->i_flags |= S_IMMUTABLE;
> -	else
> -		inode->i_flags &= ~S_IMMUTABLE;
> -	if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)
> +	if (flags & XFS_DIFLAG_APPEND)
>  		inode->i_flags |= S_APPEND;
> -	else
> -		inode->i_flags &= ~S_APPEND;
> -	if (ip->i_d.di_flags & XFS_DIFLAG_SYNC)
> +	if (flags & XFS_DIFLAG_SYNC)
>  		inode->i_flags |= S_SYNC;
> -	else
> -		inode->i_flags &= ~S_SYNC;
> -	if (ip->i_d.di_flags & XFS_DIFLAG_NOATIME)
> +	if (flags & XFS_DIFLAG_NOATIME)
>  		inode->i_flags |= S_NOATIME;
> -	else
> -		inode->i_flags &= ~S_NOATIME;
> +	/* XXX: Also needs an on-disk per inode flag! */
> +	if (ip->i_mount->m_flags & XFS_MOUNT_DAX)
> +		inode->i_flags |= S_DAX;

This is a temporary hack until we have some kind of inode flag
inheritance mechanism as mentioned in the commit log, correct?

>  }
>  
>  /*
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index 8c995a2..cd44e88 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -179,6 +179,8 @@ typedef struct xfs_mount {
>  						   allocator */
>  #define XFS_MOUNT_NOATTR2	(1ULL << 25)	/* disable use of attr2 format */
>  
> +#define XFS_MOUNT_DAX		(1ULL << 62)	/* TEST ONLY! */
> +
>  
>  /*
>   * Default minimum read and write sizes.
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 3ad0b17..0f26d7a 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -112,6 +112,8 @@ static struct xfs_kobj xfs_dbg_kobj;	/* global debug sysfs attrs */
>  #define MNTOPT_DISCARD	   "discard"	/* Discard unused blocks */
>  #define MNTOPT_NODISCARD   "nodiscard"	/* Do not discard unused blocks */
>  
> +#define MNTOPT_DAX	"dax"		/* Enable direct access to bdev pages */
> +
>  /*
>   * Table driven mount option parser.
>   *
> @@ -363,6 +365,10 @@ xfs_parseargs(
>  			mp->m_flags |= XFS_MOUNT_DISCARD;
>  		} else if (!strcmp(this_char, MNTOPT_NODISCARD)) {
>  			mp->m_flags &= ~XFS_MOUNT_DISCARD;
> +#ifdef CONFIG_FS_DAX
> +		} else if (!strcmp(this_char, MNTOPT_DAX)) {
> +			mp->m_flags |= XFS_MOUNT_DAX;
> +#endif

Something like what we do for !CONFIG_XFS_QUOTA just a few lines below
might be a bit nicer. Then we can have a slightly more useful error
message.

>  		} else {
>  			xfs_warn(mp, "unknown mount option [%s].", this_char);
>  			return -EINVAL;
> @@ -452,8 +458,8 @@ done:
>  }
>  
>  struct proc_xfs_info {
> -	int	flag;
> -	char	*str;
> +	uint64_t	flag;
> +	char		*str;
>  };
>  
>  STATIC int
> @@ -474,6 +480,7 @@ xfs_showargs(
>  		{ XFS_MOUNT_GRPID,		"," MNTOPT_GRPID },
>  		{ XFS_MOUNT_DISCARD,		"," MNTOPT_DISCARD },
>  		{ XFS_MOUNT_SMALL_INUMS,	"," MNTOPT_32BITINODE },
> +		{ XFS_MOUNT_DAX,		"," MNTOPT_DAX },
>  		{ 0, NULL }
>  	};
>  	static struct proc_xfs_info xfs_info_unset[] = {
> @@ -1501,6 +1508,20 @@ xfs_fs_fill_super(
>  	if (XFS_SB_VERSION_NUM(&mp->m_sb) == XFS_SB_VERSION_5)
>  		sb->s_flags |= MS_I_VERSION;
>  
> +	if (mp->m_flags & XFS_MOUNT_DAX) {
> +		xfs_warn(mp,
> +	"DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
> +		if (sb->s_blocksize != PAGE_SIZE) {
> +			xfs_alert(mp,
> +		"Filesystem block size invalid for DAX Turning DAX off.");
> +			mp->m_flags &= ~XFS_MOUNT_DAX;
> +		} else if (!sb->s_bdev->bd_disk->fops->direct_access) {
> +			xfs_alert(mp,
> +		"Block device does not support DAX Turning DAX off.");
> +			mp->m_flags &= ~XFS_MOUNT_DAX;
> +		}

Missing period in both error messages above. ;)

Brian

> +	}
> +
>  	error = xfs_mountfs(mp);
>  	if (error)
>  		goto out_filestream_unmount;
> -- 
> 2.0.0
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 9ca5352..695d857 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -1195,22 +1195,22 @@  xfs_diflags_to_iflags(
 	struct inode		*inode,
 	struct xfs_inode	*ip)
 {
-	if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE)
+	uint16_t		flags = ip->i_d.di_flags;
+
+	inode->i_flags &= ~(S_IMMUTABLE | S_APPEND | S_SYNC |
+			    S_NOATIME | S_DAX);
+
+	if (flags & XFS_DIFLAG_IMMUTABLE)
 		inode->i_flags |= S_IMMUTABLE;
-	else
-		inode->i_flags &= ~S_IMMUTABLE;
-	if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)
+	if (flags & XFS_DIFLAG_APPEND)
 		inode->i_flags |= S_APPEND;
-	else
-		inode->i_flags &= ~S_APPEND;
-	if (ip->i_d.di_flags & XFS_DIFLAG_SYNC)
+	if (flags & XFS_DIFLAG_SYNC)
 		inode->i_flags |= S_SYNC;
-	else
-		inode->i_flags &= ~S_SYNC;
-	if (ip->i_d.di_flags & XFS_DIFLAG_NOATIME)
+	if (flags & XFS_DIFLAG_NOATIME)
 		inode->i_flags |= S_NOATIME;
-	else
-		inode->i_flags &= ~S_NOATIME;
+	/* XXX: Also needs an on-disk per inode flag! */
+	if (ip->i_mount->m_flags & XFS_MOUNT_DAX)
+		inode->i_flags |= S_DAX;
 }
 
 /*
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 8c995a2..cd44e88 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -179,6 +179,8 @@  typedef struct xfs_mount {
 						   allocator */
 #define XFS_MOUNT_NOATTR2	(1ULL << 25)	/* disable use of attr2 format */
 
+#define XFS_MOUNT_DAX		(1ULL << 62)	/* TEST ONLY! */
+
 
 /*
  * Default minimum read and write sizes.
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 3ad0b17..0f26d7a 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -112,6 +112,8 @@  static struct xfs_kobj xfs_dbg_kobj;	/* global debug sysfs attrs */
 #define MNTOPT_DISCARD	   "discard"	/* Discard unused blocks */
 #define MNTOPT_NODISCARD   "nodiscard"	/* Do not discard unused blocks */
 
+#define MNTOPT_DAX	"dax"		/* Enable direct access to bdev pages */
+
 /*
  * Table driven mount option parser.
  *
@@ -363,6 +365,10 @@  xfs_parseargs(
 			mp->m_flags |= XFS_MOUNT_DISCARD;
 		} else if (!strcmp(this_char, MNTOPT_NODISCARD)) {
 			mp->m_flags &= ~XFS_MOUNT_DISCARD;
+#ifdef CONFIG_FS_DAX
+		} else if (!strcmp(this_char, MNTOPT_DAX)) {
+			mp->m_flags |= XFS_MOUNT_DAX;
+#endif
 		} else {
 			xfs_warn(mp, "unknown mount option [%s].", this_char);
 			return -EINVAL;
@@ -452,8 +458,8 @@  done:
 }
 
 struct proc_xfs_info {
-	int	flag;
-	char	*str;
+	uint64_t	flag;
+	char		*str;
 };
 
 STATIC int
@@ -474,6 +480,7 @@  xfs_showargs(
 		{ XFS_MOUNT_GRPID,		"," MNTOPT_GRPID },
 		{ XFS_MOUNT_DISCARD,		"," MNTOPT_DISCARD },
 		{ XFS_MOUNT_SMALL_INUMS,	"," MNTOPT_32BITINODE },
+		{ XFS_MOUNT_DAX,		"," MNTOPT_DAX },
 		{ 0, NULL }
 	};
 	static struct proc_xfs_info xfs_info_unset[] = {
@@ -1501,6 +1508,20 @@  xfs_fs_fill_super(
 	if (XFS_SB_VERSION_NUM(&mp->m_sb) == XFS_SB_VERSION_5)
 		sb->s_flags |= MS_I_VERSION;
 
+	if (mp->m_flags & XFS_MOUNT_DAX) {
+		xfs_warn(mp,
+	"DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
+		if (sb->s_blocksize != PAGE_SIZE) {
+			xfs_alert(mp,
+		"Filesystem block size invalid for DAX Turning DAX off.");
+			mp->m_flags &= ~XFS_MOUNT_DAX;
+		} else if (!sb->s_bdev->bd_disk->fops->direct_access) {
+			xfs_alert(mp,
+		"Block device does not support DAX Turning DAX off.");
+			mp->m_flags &= ~XFS_MOUNT_DAX;
+		}
+	}
+
 	error = xfs_mountfs(mp);
 	if (error)
 		goto out_filestream_unmount;