Skip to content

Commit 818d5a9

Browse files
yangx-jydjwong
authored andcommitted
fs/xfs: Support that ioctl(SETXFLAGS/GETXFLAGS) can set/get inode DAX on XFS.
1) FS_DAX_FL has been introduced by commit b383a73. 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]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 0f89edc commit 818d5a9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

fs/xfs/xfs_ioctl.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,13 +1075,18 @@ xfs_merge_ioc_xflags(
10751075
xflags |= FS_XFLAG_NODUMP;
10761076
else
10771077
xflags &= ~FS_XFLAG_NODUMP;
1078+
if (flags & FS_DAX_FL)
1079+
xflags |= FS_XFLAG_DAX;
1080+
else
1081+
xflags &= ~FS_XFLAG_DAX;
10781082

10791083
return xflags;
10801084
}
10811085

10821086
STATIC unsigned int
10831087
xfs_di2lxflags(
1084-
uint16_t di_flags)
1088+
uint16_t di_flags,
1089+
uint64_t di_flags2)
10851090
{
10861091
unsigned int flags = 0;
10871092

@@ -1095,6 +1100,9 @@ xfs_di2lxflags(
10951100
flags |= FS_NOATIME_FL;
10961101
if (di_flags & XFS_DIFLAG_NODUMP)
10971102
flags |= FS_NODUMP_FL;
1103+
if (di_flags2 & XFS_DIFLAG2_DAX) {
1104+
flags |= FS_DAX_FL;
1105+
}
10981106
return flags;
10991107
}
11001108

@@ -1565,7 +1573,7 @@ xfs_ioc_getxflags(
15651573
{
15661574
unsigned int flags;
15671575

1568-
flags = xfs_di2lxflags(ip->i_d.di_flags);
1576+
flags = xfs_di2lxflags(ip->i_d.di_flags, ip->i_d.di_flags2);
15691577
if (copy_to_user(arg, &flags, sizeof(flags)))
15701578
return -EFAULT;
15711579
return 0;
@@ -1588,7 +1596,7 @@ xfs_ioc_setxflags(
15881596

15891597
if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \
15901598
FS_NOATIME_FL | FS_NODUMP_FL | \
1591-
FS_SYNC_FL))
1599+
FS_SYNC_FL | FS_DAX_FL))
15921600
return -EOPNOTSUPP;
15931601

15941602
fa.fsx_xflags = xfs_merge_ioc_xflags(flags, xfs_ip2xflags(ip));

0 commit comments

Comments
 (0)