fs/xfs: Support that ioctl(SETXFLAGS/GETXFLAGS) can set/get inode DAX on XFS.
PATCH 1/1 fs/xfs: Support that ioctl(SETXFLAGS/GETXFLAGS) can set/get inode DAX on XFS.
1) FS_DAX_FL has been introduced by commit b383a73f2b83.
2) In future, chattr/lsattr command from e2fsprogs can set/get inode DAX on XFS by calling ioctl(SETXFLAGS/GETXFLAGS).
Signed-off-by Xiao Yang <[email protected]>
--- fs/xfs/xfs_ioctl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
fs/xfs/xfs_ioctl.c +11 -3
@@ -1075,13 +1075,18 @@ xfs_merge_ioc_xflags( xflags |=FS_XFLAG_NODUMP ; else xflags &= ~FS_XFLAG_NODUMP; +if (flags &FS_DAX_FL ) + xflags |=FS_XFLAG_DAX ; +else + xflags &= ~FS_XFLAG_DAX ;return xflags; } STATIC unsigned intxfs_di2lxflags ( -uint16_t di_flags) +uint16_t di_flags, +uint64_t di_flags2) {unsigned int flags =0 ;
@@ -1095,6 +1100,9 @@ xfs_di2lxflags( flags |=FS_NOATIME_FL ;if (di_flags &XFS_DIFLAG_NODUMP ) flags |=FS_NODUMP_FL ; +if (di_flags2 &XFS_DIFLAG2_DAX ) { + flags |=FS_DAX_FL ; + }return flags; }
@@ -1565,7 +1573,7 @@ xfs_ioc_getxflags( {unsigned int flags; - flags =xfs_di2lxflags (ip->i_d.di_flags); + flags =xfs_di2lxflags (ip->i_d.di_flags, ip->i_d.di_flags2);if (copy_to_user (arg, &flags,sizeof (flags)))return -EFAULT ;return 0 ;
@@ -1588,7 +1596,7 @@ xfs_ioc_setxflags(if (flags & ~(FS_IMMUTABLE_FL |FS_APPEND_FL | \FS_NOATIME_FL |FS_NODUMP_FL | \ -FS_SYNC_FL )) +FS_SYNC_FL |FS_DAX_FL ))return -EOPNOTSUPP ; fa.fsx_xflags =xfs_merge_ioc_xflags (flags,xfs_ip2xflags (ip));
Signature · 1 line
2.21.0
Quoted 5 lines · Xiao Yang
1)
FS_DAX_FLhas been introduced by commitb383a73f2b83.
2) In future, chattr/lsattr command from e2fsprogs can set/get inode DAX on XFS by calling ioctl(SETXFLAGS/GETXFLAGS).Signed-off-by Xiao Yang <[email protected]>
Looks fine to me,
Reviewed-by Darrick J. Wong <[email protected]>
--D
Quoted 61 lines
--- fs/xfs/xfs_ioctl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)fs/xfs/xfs_ioctl.c +11
-3@@ -1075,13 +1075,18 @@ xfs_merge_ioc_xflags( xflags |=FS_XFLAG_NODUMP ; else xflags &= ~FS_XFLAG_NODUMP; +if (flags &FS_DAX_FL ) + xflags |=FS_XFLAG_DAX ; +else + xflags &= ~FS_XFLAG_DAX ;return xflags; } STATIC unsigned intxfs_di2lxflags ( -uint16_t di_flags) +uint16_t di_flags, +uint64_t di_flags2) {unsigned int flags =0 ;@@ -1095,6 +1100,9 @@ xfs_di2lxflags( flags |=FS_NOATIME_FL ;if (di_flags &XFS_DIFLAG_NODUMP ) flags |=FS_NODUMP_FL ; +if (di_flags2 &XFS_DIFLAG2_DAX ) { + flags |=FS_DAX_FL ; + }return flags; }@@ -1565,7 +1573,7 @@ xfs_ioc_getxflags( {unsigned int flags; - flags =xfs_di2lxflags (ip->i_d.di_flags); + flags =xfs_di2lxflags (ip->i_d.di_flags, ip->i_d.di_flags2);if (copy_to_user (arg, &flags,sizeof (flags)))return -EFAULT ;return 0 ;@@ -1588,7 +1596,7 @@ xfs_ioc_setxflags(if (flags & ~(FS_IMMUTABLE_FL |FS_APPEND_FL | \FS_NOATIME_FL |FS_NODUMP_FL | \ -FS_SYNC_FL )) +FS_SYNC_FL |FS_DAX_FL ))return -EOPNOTSUPP ; fa.fsx_xflags =xfs_merge_ioc_xflags (flags,xfs_ip2xflags (ip));Signature · 1 line
2.21.0
Quoted 5 lines · Xiao Yang
1)
FS_DAX_FLhas been introduced by commitb383a73f2b83.
2) In future, chattr/lsattr command from e2fsprogs can set/get inode DAX on XFS by calling ioctl(SETXFLAGS/GETXFLAGS).Signed-off-by Xiao Yang <[email protected]>
Wow sorry for the delay. This looks good. thanks!
Reviewed-by Ira Weiny <[email protected]>
Quoted 61 lines
--- fs/xfs/xfs_ioctl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)fs/xfs/xfs_ioctl.c +11
-3@@ -1075,13 +1075,18 @@ xfs_merge_ioc_xflags( xflags |=FS_XFLAG_NODUMP ; else xflags &= ~FS_XFLAG_NODUMP; +if (flags &FS_DAX_FL ) + xflags |=FS_XFLAG_DAX ; +else + xflags &= ~FS_XFLAG_DAX ;return xflags; } STATIC unsigned intxfs_di2lxflags ( -uint16_t di_flags) +uint16_t di_flags, +uint64_t di_flags2) {unsigned int flags =0 ;@@ -1095,6 +1100,9 @@ xfs_di2lxflags( flags |=FS_NOATIME_FL ;if (di_flags &XFS_DIFLAG_NODUMP ) flags |=FS_NODUMP_FL ; +if (di_flags2 &XFS_DIFLAG2_DAX ) { + flags |=FS_DAX_FL ; + }return flags; }@@ -1565,7 +1573,7 @@ xfs_ioc_getxflags( {unsigned int flags; - flags =xfs_di2lxflags (ip->i_d.di_flags); + flags =xfs_di2lxflags (ip->i_d.di_flags, ip->i_d.di_flags2);if (copy_to_user (arg, &flags,sizeof (flags)))return -EFAULT ;return 0 ;@@ -1588,7 +1596,7 @@ xfs_ioc_setxflags(if (flags & ~(FS_IMMUTABLE_FL |FS_APPEND_FL | \FS_NOATIME_FL |FS_NODUMP_FL | \ -FS_SYNC_FL )) +FS_SYNC_FL |FS_DAX_FL ))return -EOPNOTSUPP ; fa.fsx_xflags =xfs_merge_ioc_xflags (flags,xfs_ip2xflags (ip));Signature · 1 line
2.21.0