提交 4f435ebe 编写于 作者: D Darrick J. Wong

xfs: don't mix reflink and DAX mode for now

Since we don't have a strategy for handling both DAX and reflink,
for now we'll just prohibit both being set at the same time.
Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
上级 c8e156ac
...@@ -407,6 +407,10 @@ xfs_dinode_verify( ...@@ -407,6 +407,10 @@ xfs_dinode_verify(
if ((flags2 & XFS_DIFLAG2_REFLINK) && (flags & XFS_DIFLAG_REALTIME)) if ((flags2 & XFS_DIFLAG2_REFLINK) && (flags & XFS_DIFLAG_REALTIME))
return false; return false;
/* don't let reflink and dax mix */
if ((flags2 & XFS_DIFLAG2_REFLINK) && (flags2 & XFS_DIFLAG2_DAX))
return false;
return true; return true;
} }
......
...@@ -1055,6 +1055,10 @@ xfs_file_share_range( ...@@ -1055,6 +1055,10 @@ xfs_file_share_range(
if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode)) if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode))
return -EINVAL; return -EINVAL;
/* Don't share DAX file data for now. */
if (IS_DAX(inode_in) || IS_DAX(inode_out))
return -EINVAL;
/* Are we going all the way to the end? */ /* Are we going all the way to the end? */
isize = i_size_read(inode_in); isize = i_size_read(inode_in);
if (isize == 0) if (isize == 0)
......
...@@ -1038,6 +1038,10 @@ xfs_ioctl_setattr_xflags( ...@@ -1038,6 +1038,10 @@ xfs_ioctl_setattr_xflags(
if ((fa->fsx_xflags & FS_XFLAG_REALTIME) && xfs_is_reflink_inode(ip)) if ((fa->fsx_xflags & FS_XFLAG_REALTIME) && xfs_is_reflink_inode(ip))
return -EINVAL; return -EINVAL;
/* Don't allow us to set DAX mode for a reflinked file for now. */
if ((fa->fsx_xflags & FS_XFLAG_DAX) && xfs_is_reflink_inode(ip))
return -EINVAL;
/* /*
* Can't modify an immutable/append-only file unless * Can't modify an immutable/append-only file unless
* we have appropriate permission. * we have appropriate permission.
......
...@@ -1144,6 +1144,7 @@ xfs_diflags_to_iflags( ...@@ -1144,6 +1144,7 @@ xfs_diflags_to_iflags(
inode->i_flags |= S_NOATIME; inode->i_flags |= S_NOATIME;
if (S_ISREG(inode->i_mode) && if (S_ISREG(inode->i_mode) &&
ip->i_mount->m_sb.sb_blocksize == PAGE_SIZE && ip->i_mount->m_sb.sb_blocksize == PAGE_SIZE &&
!xfs_is_reflink_inode(ip) &&
(ip->i_mount->m_flags & XFS_MOUNT_DAX || (ip->i_mount->m_flags & XFS_MOUNT_DAX ||
ip->i_d.di_flags2 & XFS_DIFLAG2_DAX)) ip->i_d.di_flags2 & XFS_DIFLAG2_DAX))
inode->i_flags |= S_DAX; inode->i_flags |= S_DAX;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册