diff options
author | Dave Chinner <david@fromorbit.com> | 2016-01-18 16:16:08 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-01-18 16:16:08 -0500 |
commit | 4c931f770d327f4851917828a1682d030b53d021 (patch) | |
tree | c7b98ca2dacf3b39e4233e96002ca80b6833017a | |
parent | dde7f55bd000696acc38296c21241971e1840142 (diff) | |
parent | 58f88ca2df7270881de2034c8286233a89efe71c (diff) |
Merge branch 'xfs-setxattr-promotion' into for-next
-rw-r--r-- | fs/xfs/libxfs/xfs_format.h | 11 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_fs.h | 38 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 60 | ||||
-rw-r--r-- | fs/xfs/xfs_ioctl.c | 92 | ||||
-rw-r--r-- | fs/xfs/xfs_iops.c | 4 | ||||
-rw-r--r-- | include/uapi/linux/fs.h | 33 |
6 files changed, 137 insertions, 101 deletions
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index e2536bb1c760..dc97eb21af07 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h | |||
@@ -984,8 +984,6 @@ static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev) | |||
984 | 984 | ||
985 | /* | 985 | /* |
986 | * Values for di_flags | 986 | * Values for di_flags |
987 | * There should be a one-to-one correspondence between these flags and the | ||
988 | * XFS_XFLAG_s. | ||
989 | */ | 987 | */ |
990 | #define XFS_DIFLAG_REALTIME_BIT 0 /* file's blocks come from rt area */ | 988 | #define XFS_DIFLAG_REALTIME_BIT 0 /* file's blocks come from rt area */ |
991 | #define XFS_DIFLAG_PREALLOC_BIT 1 /* file space has been preallocated */ | 989 | #define XFS_DIFLAG_PREALLOC_BIT 1 /* file space has been preallocated */ |
@@ -1026,6 +1024,15 @@ static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev) | |||
1026 | XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_NODEFRAG | XFS_DIFLAG_FILESTREAM) | 1024 | XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_NODEFRAG | XFS_DIFLAG_FILESTREAM) |
1027 | 1025 | ||
1028 | /* | 1026 | /* |
1027 | * Values for di_flags2 These start by being exposed to userspace in the upper | ||
1028 | * 16 bits of the XFS_XFLAG_s range. | ||
1029 | */ | ||
1030 | #define XFS_DIFLAG2_DAX_BIT 0 /* use DAX for this inode */ | ||
1031 | #define XFS_DIFLAG2_DAX (1 << XFS_DIFLAG2_DAX_BIT) | ||
1032 | |||
1033 | #define XFS_DIFLAG2_ANY (XFS_DIFLAG2_DAX) | ||
1034 | |||
1035 | /* | ||
1029 | * Inode number format: | 1036 | * Inode number format: |
1030 | * low inopblog bits - offset in block | 1037 | * low inopblog bits - offset in block |
1031 | * next agblklog bits - block number in ag | 1038 | * next agblklog bits - block number in ag |
diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h index b2b73a998d42..fffe3d01bd9f 100644 --- a/fs/xfs/libxfs/xfs_fs.h +++ b/fs/xfs/libxfs/xfs_fs.h | |||
@@ -36,40 +36,6 @@ struct dioattr { | |||
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * Structure for XFS_IOC_FSGETXATTR[A] and XFS_IOC_FSSETXATTR. | ||
40 | */ | ||
41 | #ifndef HAVE_FSXATTR | ||
42 | struct fsxattr { | ||
43 | __u32 fsx_xflags; /* xflags field value (get/set) */ | ||
44 | __u32 fsx_extsize; /* extsize field value (get/set)*/ | ||
45 | __u32 fsx_nextents; /* nextents field value (get) */ | ||
46 | __u32 fsx_projid; /* project identifier (get/set) */ | ||
47 | unsigned char fsx_pad[12]; | ||
48 | }; | ||
49 | #endif | ||
50 | |||
51 | /* | ||
52 | * Flags for the bs_xflags/fsx_xflags field | ||
53 | * There should be a one-to-one correspondence between these flags and the | ||
54 | * XFS_DIFLAG_s. | ||
55 | */ | ||
56 | #define XFS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */ | ||
57 | #define XFS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */ | ||
58 | #define XFS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */ | ||
59 | #define XFS_XFLAG_APPEND 0x00000010 /* all writes append */ | ||
60 | #define XFS_XFLAG_SYNC 0x00000020 /* all writes synchronous */ | ||
61 | #define XFS_XFLAG_NOATIME 0x00000040 /* do not update access time */ | ||
62 | #define XFS_XFLAG_NODUMP 0x00000080 /* do not include in backups */ | ||
63 | #define XFS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */ | ||
64 | #define XFS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */ | ||
65 | #define XFS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */ | ||
66 | #define XFS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */ | ||
67 | #define XFS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */ | ||
68 | #define XFS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */ | ||
69 | #define XFS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */ | ||
70 | #define XFS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ | ||
71 | |||
72 | /* | ||
73 | * Structure for XFS_IOC_GETBMAP. | 39 | * Structure for XFS_IOC_GETBMAP. |
74 | * On input, fill in bmv_offset and bmv_length of the first structure | 40 | * On input, fill in bmv_offset and bmv_length of the first structure |
75 | * to indicate the area of interest in the file, and bmv_entries with | 41 | * to indicate the area of interest in the file, and bmv_entries with |
@@ -514,8 +480,8 @@ typedef struct xfs_swapext | |||
514 | #define XFS_IOC_ALLOCSP _IOW ('X', 10, struct xfs_flock64) | 480 | #define XFS_IOC_ALLOCSP _IOW ('X', 10, struct xfs_flock64) |
515 | #define XFS_IOC_FREESP _IOW ('X', 11, struct xfs_flock64) | 481 | #define XFS_IOC_FREESP _IOW ('X', 11, struct xfs_flock64) |
516 | #define XFS_IOC_DIOINFO _IOR ('X', 30, struct dioattr) | 482 | #define XFS_IOC_DIOINFO _IOR ('X', 30, struct dioattr) |
517 | #define XFS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr) | 483 | #define XFS_IOC_FSGETXATTR FS_IOC_FSGETXATTR |
518 | #define XFS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr) | 484 | #define XFS_IOC_FSSETXATTR FS_IOC_FSSETXATTR |
519 | #define XFS_IOC_ALLOCSP64 _IOW ('X', 36, struct xfs_flock64) | 485 | #define XFS_IOC_ALLOCSP64 _IOW ('X', 36, struct xfs_flock64) |
520 | #define XFS_IOC_FREESP64 _IOW ('X', 37, struct xfs_flock64) | 486 | #define XFS_IOC_FREESP64 _IOW ('X', 37, struct xfs_flock64) |
521 | #define XFS_IOC_GETBMAP _IOWR('X', 38, struct getbmap) | 487 | #define XFS_IOC_GETBMAP _IOWR('X', 38, struct getbmap) |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index ae3758a90ed6..ceba1a83cacc 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -610,60 +610,69 @@ __xfs_iflock( | |||
610 | 610 | ||
611 | STATIC uint | 611 | STATIC uint |
612 | _xfs_dic2xflags( | 612 | _xfs_dic2xflags( |
613 | __uint16_t di_flags) | 613 | __uint16_t di_flags, |
614 | uint64_t di_flags2, | ||
615 | bool has_attr) | ||
614 | { | 616 | { |
615 | uint flags = 0; | 617 | uint flags = 0; |
616 | 618 | ||
617 | if (di_flags & XFS_DIFLAG_ANY) { | 619 | if (di_flags & XFS_DIFLAG_ANY) { |
618 | if (di_flags & XFS_DIFLAG_REALTIME) | 620 | if (di_flags & XFS_DIFLAG_REALTIME) |
619 | flags |= XFS_XFLAG_REALTIME; | 621 | flags |= FS_XFLAG_REALTIME; |
620 | if (di_flags & XFS_DIFLAG_PREALLOC) | 622 | if (di_flags & XFS_DIFLAG_PREALLOC) |
621 | flags |= XFS_XFLAG_PREALLOC; | 623 | flags |= FS_XFLAG_PREALLOC; |
622 | if (di_flags & XFS_DIFLAG_IMMUTABLE) | 624 | if (di_flags & XFS_DIFLAG_IMMUTABLE) |
623 | flags |= XFS_XFLAG_IMMUTABLE; | 625 | flags |= FS_XFLAG_IMMUTABLE; |
624 | if (di_flags & XFS_DIFLAG_APPEND) | 626 | if (di_flags & XFS_DIFLAG_APPEND) |
625 | flags |= XFS_XFLAG_APPEND; | 627 | flags |= FS_XFLAG_APPEND; |
626 | if (di_flags & XFS_DIFLAG_SYNC) | 628 | if (di_flags & XFS_DIFLAG_SYNC) |
627 | flags |= XFS_XFLAG_SYNC; | 629 | flags |= FS_XFLAG_SYNC; |
628 | if (di_flags & XFS_DIFLAG_NOATIME) | 630 | if (di_flags & XFS_DIFLAG_NOATIME) |
629 | flags |= XFS_XFLAG_NOATIME; | 631 | flags |= FS_XFLAG_NOATIME; |
630 | if (di_flags & XFS_DIFLAG_NODUMP) | 632 | if (di_flags & XFS_DIFLAG_NODUMP) |
631 | flags |= XFS_XFLAG_NODUMP; | 633 | flags |= FS_XFLAG_NODUMP; |
632 | if (di_flags & XFS_DIFLAG_RTINHERIT) | 634 | if (di_flags & XFS_DIFLAG_RTINHERIT) |
633 | flags |= XFS_XFLAG_RTINHERIT; | 635 | flags |= FS_XFLAG_RTINHERIT; |
634 | if (di_flags & XFS_DIFLAG_PROJINHERIT) | 636 | if (di_flags & XFS_DIFLAG_PROJINHERIT) |
635 | flags |= XFS_XFLAG_PROJINHERIT; | 637 | flags |= FS_XFLAG_PROJINHERIT; |
636 | if (di_flags & XFS_DIFLAG_NOSYMLINKS) | 638 | if (di_flags & XFS_DIFLAG_NOSYMLINKS) |
637 | flags |= XFS_XFLAG_NOSYMLINKS; | 639 | flags |= FS_XFLAG_NOSYMLINKS; |
638 | if (di_flags & XFS_DIFLAG_EXTSIZE) | 640 | if (di_flags & XFS_DIFLAG_EXTSIZE) |
639 | flags |= XFS_XFLAG_EXTSIZE; | 641 | flags |= FS_XFLAG_EXTSIZE; |
640 | if (di_flags & XFS_DIFLAG_EXTSZINHERIT) | 642 | if (di_flags & XFS_DIFLAG_EXTSZINHERIT) |
641 | flags |= XFS_XFLAG_EXTSZINHERIT; | 643 | flags |= FS_XFLAG_EXTSZINHERIT; |
642 | if (di_flags & XFS_DIFLAG_NODEFRAG) | 644 | if (di_flags & XFS_DIFLAG_NODEFRAG) |
643 | flags |= XFS_XFLAG_NODEFRAG; | 645 | flags |= FS_XFLAG_NODEFRAG; |
644 | if (di_flags & XFS_DIFLAG_FILESTREAM) | 646 | if (di_flags & XFS_DIFLAG_FILESTREAM) |
645 | flags |= XFS_XFLAG_FILESTREAM; | 647 | flags |= FS_XFLAG_FILESTREAM; |
646 | } | 648 | } |
647 | 649 | ||
650 | if (di_flags2 & XFS_DIFLAG2_ANY) { | ||
651 | if (di_flags2 & XFS_DIFLAG2_DAX) | ||
652 | flags |= FS_XFLAG_DAX; | ||
653 | } | ||
654 | |||
655 | if (has_attr) | ||
656 | flags |= FS_XFLAG_HASATTR; | ||
657 | |||
648 | return flags; | 658 | return flags; |
649 | } | 659 | } |
650 | 660 | ||
651 | uint | 661 | uint |
652 | xfs_ip2xflags( | 662 | xfs_ip2xflags( |
653 | xfs_inode_t *ip) | 663 | struct xfs_inode *ip) |
654 | { | 664 | { |
655 | xfs_icdinode_t *dic = &ip->i_d; | 665 | struct xfs_icdinode *dic = &ip->i_d; |
656 | 666 | ||
657 | return _xfs_dic2xflags(dic->di_flags) | | 667 | return _xfs_dic2xflags(dic->di_flags, dic->di_flags2, XFS_IFORK_Q(ip)); |
658 | (XFS_IFORK_Q(ip) ? XFS_XFLAG_HASATTR : 0); | ||
659 | } | 668 | } |
660 | 669 | ||
661 | uint | 670 | uint |
662 | xfs_dic2xflags( | 671 | xfs_dic2xflags( |
663 | xfs_dinode_t *dip) | 672 | struct xfs_dinode *dip) |
664 | { | 673 | { |
665 | return _xfs_dic2xflags(be16_to_cpu(dip->di_flags)) | | 674 | return _xfs_dic2xflags(be16_to_cpu(dip->di_flags), |
666 | (XFS_DFORK_Q(dip) ? XFS_XFLAG_HASATTR : 0); | 675 | be64_to_cpu(dip->di_flags2), XFS_DFORK_Q(dip)); |
667 | } | 676 | } |
668 | 677 | ||
669 | /* | 678 | /* |
@@ -862,7 +871,8 @@ xfs_ialloc( | |||
862 | case S_IFREG: | 871 | case S_IFREG: |
863 | case S_IFDIR: | 872 | case S_IFDIR: |
864 | if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) { | 873 | if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) { |
865 | uint di_flags = 0; | 874 | uint64_t di_flags2 = 0; |
875 | uint di_flags = 0; | ||
866 | 876 | ||
867 | if (S_ISDIR(mode)) { | 877 | if (S_ISDIR(mode)) { |
868 | if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) | 878 | if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) |
@@ -898,7 +908,11 @@ xfs_ialloc( | |||
898 | di_flags |= XFS_DIFLAG_NODEFRAG; | 908 | di_flags |= XFS_DIFLAG_NODEFRAG; |
899 | if (pip->i_d.di_flags & XFS_DIFLAG_FILESTREAM) | 909 | if (pip->i_d.di_flags & XFS_DIFLAG_FILESTREAM) |
900 | di_flags |= XFS_DIFLAG_FILESTREAM; | 910 | di_flags |= XFS_DIFLAG_FILESTREAM; |
911 | if (pip->i_d.di_flags2 & XFS_DIFLAG2_DAX) | ||
912 | di_flags2 |= XFS_DIFLAG2_DAX; | ||
913 | |||
901 | ip->i_d.di_flags |= di_flags; | 914 | ip->i_d.di_flags |= di_flags; |
915 | ip->i_d.di_flags2 |= di_flags2; | ||
902 | } | 916 | } |
903 | /* FALLTHROUGH */ | 917 | /* FALLTHROUGH */ |
904 | case S_IFLNK: | 918 | case S_IFLNK: |
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index d42738deec6d..478d04e07f95 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c | |||
@@ -859,25 +859,25 @@ xfs_merge_ioc_xflags( | |||
859 | unsigned int xflags = start; | 859 | unsigned int xflags = start; |
860 | 860 | ||
861 | if (flags & FS_IMMUTABLE_FL) | 861 | if (flags & FS_IMMUTABLE_FL) |
862 | xflags |= XFS_XFLAG_IMMUTABLE; | 862 | xflags |= FS_XFLAG_IMMUTABLE; |
863 | else | 863 | else |
864 | xflags &= ~XFS_XFLAG_IMMUTABLE; | 864 | xflags &= ~FS_XFLAG_IMMUTABLE; |
865 | if (flags & FS_APPEND_FL) | 865 | if (flags & FS_APPEND_FL) |
866 | xflags |= XFS_XFLAG_APPEND; | 866 | xflags |= FS_XFLAG_APPEND; |
867 | else | 867 | else |
868 | xflags &= ~XFS_XFLAG_APPEND; | 868 | xflags &= ~FS_XFLAG_APPEND; |
869 | if (flags & FS_SYNC_FL) | 869 | if (flags & FS_SYNC_FL) |
870 | xflags |= XFS_XFLAG_SYNC; | 870 | xflags |= FS_XFLAG_SYNC; |
871 | else | 871 | else |
872 | xflags &= ~XFS_XFLAG_SYNC; | 872 | xflags &= ~FS_XFLAG_SYNC; |
873 | if (flags & FS_NOATIME_FL) | 873 | if (flags & FS_NOATIME_FL) |
874 | xflags |= XFS_XFLAG_NOATIME; | 874 | xflags |= FS_XFLAG_NOATIME; |
875 | else | 875 | else |
876 | xflags &= ~XFS_XFLAG_NOATIME; | 876 | xflags &= ~FS_XFLAG_NOATIME; |
877 | if (flags & FS_NODUMP_FL) | 877 | if (flags & FS_NODUMP_FL) |
878 | xflags |= XFS_XFLAG_NODUMP; | 878 | xflags |= FS_XFLAG_NODUMP; |
879 | else | 879 | else |
880 | xflags &= ~XFS_XFLAG_NODUMP; | 880 | xflags &= ~FS_XFLAG_NODUMP; |
881 | 881 | ||
882 | return xflags; | 882 | return xflags; |
883 | } | 883 | } |
@@ -945,40 +945,51 @@ xfs_set_diflags( | |||
945 | unsigned int xflags) | 945 | unsigned int xflags) |
946 | { | 946 | { |
947 | unsigned int di_flags; | 947 | unsigned int di_flags; |
948 | uint64_t di_flags2; | ||
948 | 949 | ||
949 | /* can't set PREALLOC this way, just preserve it */ | 950 | /* can't set PREALLOC this way, just preserve it */ |
950 | di_flags = (ip->i_d.di_flags & XFS_DIFLAG_PREALLOC); | 951 | di_flags = (ip->i_d.di_flags & XFS_DIFLAG_PREALLOC); |
951 | if (xflags & XFS_XFLAG_IMMUTABLE) | 952 | if (xflags & FS_XFLAG_IMMUTABLE) |
952 | di_flags |= XFS_DIFLAG_IMMUTABLE; | 953 | di_flags |= XFS_DIFLAG_IMMUTABLE; |
953 | if (xflags & XFS_XFLAG_APPEND) | 954 | if (xflags & FS_XFLAG_APPEND) |
954 | di_flags |= XFS_DIFLAG_APPEND; | 955 | di_flags |= XFS_DIFLAG_APPEND; |
955 | if (xflags & XFS_XFLAG_SYNC) | 956 | if (xflags & FS_XFLAG_SYNC) |
956 | di_flags |= XFS_DIFLAG_SYNC; | 957 | di_flags |= XFS_DIFLAG_SYNC; |
957 | if (xflags & XFS_XFLAG_NOATIME) | 958 | if (xflags & FS_XFLAG_NOATIME) |
958 | di_flags |= XFS_DIFLAG_NOATIME; | 959 | di_flags |= XFS_DIFLAG_NOATIME; |
959 | if (xflags & XFS_XFLAG_NODUMP) | 960 | if (xflags & FS_XFLAG_NODUMP) |
960 | di_flags |= XFS_DIFLAG_NODUMP; | 961 | di_flags |= XFS_DIFLAG_NODUMP; |
961 | if (xflags & XFS_XFLAG_NODEFRAG) | 962 | if (xflags & FS_XFLAG_NODEFRAG) |
962 | di_flags |= XFS_DIFLAG_NODEFRAG; | 963 | di_flags |= XFS_DIFLAG_NODEFRAG; |
963 | if (xflags & XFS_XFLAG_FILESTREAM) | 964 | if (xflags & FS_XFLAG_FILESTREAM) |
964 | di_flags |= XFS_DIFLAG_FILESTREAM; | 965 | di_flags |= XFS_DIFLAG_FILESTREAM; |
965 | if (S_ISDIR(ip->i_d.di_mode)) { | 966 | if (S_ISDIR(ip->i_d.di_mode)) { |
966 | if (xflags & XFS_XFLAG_RTINHERIT) | 967 | if (xflags & FS_XFLAG_RTINHERIT) |
967 | di_flags |= XFS_DIFLAG_RTINHERIT; | 968 | di_flags |= XFS_DIFLAG_RTINHERIT; |
968 | if (xflags & XFS_XFLAG_NOSYMLINKS) | 969 | if (xflags & FS_XFLAG_NOSYMLINKS) |
969 | di_flags |= XFS_DIFLAG_NOSYMLINKS; | 970 | di_flags |= XFS_DIFLAG_NOSYMLINKS; |
970 | if (xflags & XFS_XFLAG_EXTSZINHERIT) | 971 | if (xflags & FS_XFLAG_EXTSZINHERIT) |
971 | di_flags |= XFS_DIFLAG_EXTSZINHERIT; | 972 | di_flags |= XFS_DIFLAG_EXTSZINHERIT; |
972 | if (xflags & XFS_XFLAG_PROJINHERIT) | 973 | if (xflags & FS_XFLAG_PROJINHERIT) |
973 | di_flags |= XFS_DIFLAG_PROJINHERIT; | 974 | di_flags |= XFS_DIFLAG_PROJINHERIT; |
974 | } else if (S_ISREG(ip->i_d.di_mode)) { | 975 | } else if (S_ISREG(ip->i_d.di_mode)) { |
975 | if (xflags & XFS_XFLAG_REALTIME) | 976 | if (xflags & FS_XFLAG_REALTIME) |
976 | di_flags |= XFS_DIFLAG_REALTIME; | 977 | di_flags |= XFS_DIFLAG_REALTIME; |
977 | if (xflags & XFS_XFLAG_EXTSIZE) | 978 | if (xflags & FS_XFLAG_EXTSIZE) |
978 | di_flags |= XFS_DIFLAG_EXTSIZE; | 979 | di_flags |= XFS_DIFLAG_EXTSIZE; |
979 | } | 980 | } |
980 | |||
981 | ip->i_d.di_flags = di_flags; | 981 | ip->i_d.di_flags = di_flags; |
982 | |||
983 | /* diflags2 only valid for v3 inodes. */ | ||
984 | if (ip->i_d.di_version < 3) | ||
985 | return; | ||
986 | |||
987 | di_flags2 = 0; | ||
988 | if (xflags & FS_XFLAG_DAX) | ||
989 | di_flags2 |= XFS_DIFLAG2_DAX; | ||
990 | |||
991 | ip->i_d.di_flags2 = di_flags2; | ||
992 | |||
982 | } | 993 | } |
983 | 994 | ||
984 | STATIC void | 995 | STATIC void |
@@ -988,22 +999,27 @@ xfs_diflags_to_linux( | |||
988 | struct inode *inode = VFS_I(ip); | 999 | struct inode *inode = VFS_I(ip); |
989 | unsigned int xflags = xfs_ip2xflags(ip); | 1000 | unsigned int xflags = xfs_ip2xflags(ip); |
990 | 1001 | ||
991 | if (xflags & XFS_XFLAG_IMMUTABLE) | 1002 | if (xflags & FS_XFLAG_IMMUTABLE) |
992 | inode->i_flags |= S_IMMUTABLE; | 1003 | inode->i_flags |= S_IMMUTABLE; |
993 | else | 1004 | else |
994 | inode->i_flags &= ~S_IMMUTABLE; | 1005 | inode->i_flags &= ~S_IMMUTABLE; |
995 | if (xflags & XFS_XFLAG_APPEND) | 1006 | if (xflags & FS_XFLAG_APPEND) |
996 | inode->i_flags |= S_APPEND; | 1007 | inode->i_flags |= S_APPEND; |
997 | else | 1008 | else |
998 | inode->i_flags &= ~S_APPEND; | 1009 | inode->i_flags &= ~S_APPEND; |
999 | if (xflags & XFS_XFLAG_SYNC) | 1010 | if (xflags & FS_XFLAG_SYNC) |
1000 | inode->i_flags |= S_SYNC; | 1011 | inode->i_flags |= S_SYNC; |
1001 | else | 1012 | else |
1002 | inode->i_flags &= ~S_SYNC; | 1013 | inode->i_flags &= ~S_SYNC; |
1003 | if (xflags & XFS_XFLAG_NOATIME) | 1014 | if (xflags & FS_XFLAG_NOATIME) |
1004 | inode->i_flags |= S_NOATIME; | 1015 | inode->i_flags |= S_NOATIME; |
1005 | else | 1016 | else |
1006 | inode->i_flags &= ~S_NOATIME; | 1017 | inode->i_flags &= ~S_NOATIME; |
1018 | if (xflags & FS_XFLAG_DAX) | ||
1019 | inode->i_flags |= S_DAX; | ||
1020 | else | ||
1021 | inode->i_flags &= ~S_DAX; | ||
1022 | |||
1007 | } | 1023 | } |
1008 | 1024 | ||
1009 | static int | 1025 | static int |
@@ -1016,11 +1032,11 @@ xfs_ioctl_setattr_xflags( | |||
1016 | 1032 | ||
1017 | /* Can't change realtime flag if any extents are allocated. */ | 1033 | /* Can't change realtime flag if any extents are allocated. */ |
1018 | if ((ip->i_d.di_nextents || ip->i_delayed_blks) && | 1034 | if ((ip->i_d.di_nextents || ip->i_delayed_blks) && |
1019 | XFS_IS_REALTIME_INODE(ip) != (fa->fsx_xflags & XFS_XFLAG_REALTIME)) | 1035 | XFS_IS_REALTIME_INODE(ip) != (fa->fsx_xflags & FS_XFLAG_REALTIME)) |
1020 | return -EINVAL; | 1036 | return -EINVAL; |
1021 | 1037 | ||
1022 | /* If realtime flag is set then must have realtime device */ | 1038 | /* If realtime flag is set then must have realtime device */ |
1023 | if (fa->fsx_xflags & XFS_XFLAG_REALTIME) { | 1039 | if (fa->fsx_xflags & FS_XFLAG_REALTIME) { |
1024 | if (mp->m_sb.sb_rblocks == 0 || mp->m_sb.sb_rextsize == 0 || | 1040 | if (mp->m_sb.sb_rblocks == 0 || mp->m_sb.sb_rextsize == 0 || |
1025 | (ip->i_d.di_extsize % mp->m_sb.sb_rextsize)) | 1041 | (ip->i_d.di_extsize % mp->m_sb.sb_rextsize)) |
1026 | return -EINVAL; | 1042 | return -EINVAL; |
@@ -1031,7 +1047,7 @@ xfs_ioctl_setattr_xflags( | |||
1031 | * we have appropriate permission. | 1047 | * we have appropriate permission. |
1032 | */ | 1048 | */ |
1033 | if (((ip->i_d.di_flags & (XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND)) || | 1049 | if (((ip->i_d.di_flags & (XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND)) || |
1034 | (fa->fsx_xflags & (XFS_XFLAG_IMMUTABLE | XFS_XFLAG_APPEND))) && | 1050 | (fa->fsx_xflags & (FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND))) && |
1035 | !capable(CAP_LINUX_IMMUTABLE)) | 1051 | !capable(CAP_LINUX_IMMUTABLE)) |
1036 | return -EPERM; | 1052 | return -EPERM; |
1037 | 1053 | ||
@@ -1095,8 +1111,8 @@ out_cancel: | |||
1095 | * extent size hint validation is somewhat cumbersome. Rules are: | 1111 | * extent size hint validation is somewhat cumbersome. Rules are: |
1096 | * | 1112 | * |
1097 | * 1. extent size hint is only valid for directories and regular files | 1113 | * 1. extent size hint is only valid for directories and regular files |
1098 | * 2. XFS_XFLAG_EXTSIZE is only valid for regular files | 1114 | * 2. FS_XFLAG_EXTSIZE is only valid for regular files |
1099 | * 3. XFS_XFLAG_EXTSZINHERIT is only valid for directories. | 1115 | * 3. FS_XFLAG_EXTSZINHERIT is only valid for directories. |
1100 | * 4. can only be changed on regular files if no extents are allocated | 1116 | * 4. can only be changed on regular files if no extents are allocated |
1101 | * 5. can be changed on directories at any time | 1117 | * 5. can be changed on directories at any time |
1102 | * 6. extsize hint of 0 turns off hints, clears inode flags. | 1118 | * 6. extsize hint of 0 turns off hints, clears inode flags. |
@@ -1112,10 +1128,10 @@ xfs_ioctl_setattr_check_extsize( | |||
1112 | { | 1128 | { |
1113 | struct xfs_mount *mp = ip->i_mount; | 1129 | struct xfs_mount *mp = ip->i_mount; |
1114 | 1130 | ||
1115 | if ((fa->fsx_xflags & XFS_XFLAG_EXTSIZE) && !S_ISREG(ip->i_d.di_mode)) | 1131 | if ((fa->fsx_xflags & FS_XFLAG_EXTSIZE) && !S_ISREG(ip->i_d.di_mode)) |
1116 | return -EINVAL; | 1132 | return -EINVAL; |
1117 | 1133 | ||
1118 | if ((fa->fsx_xflags & XFS_XFLAG_EXTSZINHERIT) && | 1134 | if ((fa->fsx_xflags & FS_XFLAG_EXTSZINHERIT) && |
1119 | !S_ISDIR(ip->i_d.di_mode)) | 1135 | !S_ISDIR(ip->i_d.di_mode)) |
1120 | return -EINVAL; | 1136 | return -EINVAL; |
1121 | 1137 | ||
@@ -1132,7 +1148,7 @@ xfs_ioctl_setattr_check_extsize( | |||
1132 | return -EINVAL; | 1148 | return -EINVAL; |
1133 | 1149 | ||
1134 | if (XFS_IS_REALTIME_INODE(ip) || | 1150 | if (XFS_IS_REALTIME_INODE(ip) || |
1135 | (fa->fsx_xflags & XFS_XFLAG_REALTIME)) { | 1151 | (fa->fsx_xflags & FS_XFLAG_REALTIME)) { |
1136 | size = mp->m_sb.sb_rextsize << mp->m_sb.sb_blocklog; | 1152 | size = mp->m_sb.sb_rextsize << mp->m_sb.sb_blocklog; |
1137 | } else { | 1153 | } else { |
1138 | size = mp->m_sb.sb_blocksize; | 1154 | size = mp->m_sb.sb_blocksize; |
@@ -1143,7 +1159,7 @@ xfs_ioctl_setattr_check_extsize( | |||
1143 | if (fa->fsx_extsize % size) | 1159 | if (fa->fsx_extsize % size) |
1144 | return -EINVAL; | 1160 | return -EINVAL; |
1145 | } else | 1161 | } else |
1146 | fa->fsx_xflags &= ~(XFS_XFLAG_EXTSIZE | XFS_XFLAG_EXTSZINHERIT); | 1162 | fa->fsx_xflags &= ~(FS_XFLAG_EXTSIZE | FS_XFLAG_EXTSZINHERIT); |
1147 | 1163 | ||
1148 | return 0; | 1164 | return 0; |
1149 | } | 1165 | } |
@@ -1168,7 +1184,7 @@ xfs_ioctl_setattr_check_projid( | |||
1168 | 1184 | ||
1169 | if (xfs_get_projid(ip) != fa->fsx_projid) | 1185 | if (xfs_get_projid(ip) != fa->fsx_projid) |
1170 | return -EINVAL; | 1186 | return -EINVAL; |
1171 | if ((fa->fsx_xflags & XFS_XFLAG_PROJINHERIT) != | 1187 | if ((fa->fsx_xflags & FS_XFLAG_PROJINHERIT) != |
1172 | (ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)) | 1188 | (ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)) |
1173 | return -EINVAL; | 1189 | return -EINVAL; |
1174 | 1190 | ||
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 245268a0cdf0..a1b8af158d05 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
@@ -1201,8 +1201,8 @@ xfs_diflags_to_iflags( | |||
1201 | inode->i_flags |= S_SYNC; | 1201 | inode->i_flags |= S_SYNC; |
1202 | if (flags & XFS_DIFLAG_NOATIME) | 1202 | if (flags & XFS_DIFLAG_NOATIME) |
1203 | inode->i_flags |= S_NOATIME; | 1203 | inode->i_flags |= S_NOATIME; |
1204 | /* XXX: Also needs an on-disk per inode flag! */ | 1204 | if (ip->i_mount->m_flags & XFS_MOUNT_DAX || |
1205 | if (ip->i_mount->m_flags & XFS_MOUNT_DAX) | 1205 | ip->i_d.di_flags2 & XFS_DIFLAG2_DAX) |
1206 | inode->i_flags |= S_DAX; | 1206 | inode->i_flags |= S_DAX; |
1207 | } | 1207 | } |
1208 | 1208 | ||
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index f15d980249b5..4cad4c8ab6b2 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h | |||
@@ -110,6 +110,37 @@ struct inodes_stat_t { | |||
110 | #define MS_MGC_VAL 0xC0ED0000 | 110 | #define MS_MGC_VAL 0xC0ED0000 |
111 | #define MS_MGC_MSK 0xffff0000 | 111 | #define MS_MGC_MSK 0xffff0000 |
112 | 112 | ||
113 | /* | ||
114 | * Structure for FS_IOC_FSGETXATTR[A] and FS_IOC_FSSETXATTR. | ||
115 | */ | ||
116 | struct fsxattr { | ||
117 | __u32 fsx_xflags; /* xflags field value (get/set) */ | ||
118 | __u32 fsx_extsize; /* extsize field value (get/set)*/ | ||
119 | __u32 fsx_nextents; /* nextents field value (get) */ | ||
120 | __u32 fsx_projid; /* project identifier (get/set) */ | ||
121 | unsigned char fsx_pad[12]; | ||
122 | }; | ||
123 | |||
124 | /* | ||
125 | * Flags for the fsx_xflags field | ||
126 | */ | ||
127 | #define FS_XFLAG_REALTIME 0x00000001 /* data in realtime volume */ | ||
128 | #define FS_XFLAG_PREALLOC 0x00000002 /* preallocated file extents */ | ||
129 | #define FS_XFLAG_IMMUTABLE 0x00000008 /* file cannot be modified */ | ||
130 | #define FS_XFLAG_APPEND 0x00000010 /* all writes append */ | ||
131 | #define FS_XFLAG_SYNC 0x00000020 /* all writes synchronous */ | ||
132 | #define FS_XFLAG_NOATIME 0x00000040 /* do not update access time */ | ||
133 | #define FS_XFLAG_NODUMP 0x00000080 /* do not include in backups */ | ||
134 | #define FS_XFLAG_RTINHERIT 0x00000100 /* create with rt bit set */ | ||
135 | #define FS_XFLAG_PROJINHERIT 0x00000200 /* create with parents projid */ | ||
136 | #define FS_XFLAG_NOSYMLINKS 0x00000400 /* disallow symlink creation */ | ||
137 | #define FS_XFLAG_EXTSIZE 0x00000800 /* extent size allocator hint */ | ||
138 | #define FS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */ | ||
139 | #define FS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */ | ||
140 | #define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */ | ||
141 | #define FS_XFLAG_DAX 0x00008000 /* use DAX for IO */ | ||
142 | #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ | ||
143 | |||
113 | /* the read-only stuff doesn't really belong here, but any other place is | 144 | /* the read-only stuff doesn't really belong here, but any other place is |
114 | probably as bad and I don't want to create yet another include file. */ | 145 | probably as bad and I don't want to create yet another include file. */ |
115 | 146 | ||
@@ -169,6 +200,8 @@ struct inodes_stat_t { | |||
169 | #define FS_IOC32_SETFLAGS _IOW('f', 2, int) | 200 | #define FS_IOC32_SETFLAGS _IOW('f', 2, int) |
170 | #define FS_IOC32_GETVERSION _IOR('v', 1, int) | 201 | #define FS_IOC32_GETVERSION _IOR('v', 1, int) |
171 | #define FS_IOC32_SETVERSION _IOW('v', 2, int) | 202 | #define FS_IOC32_SETVERSION _IOW('v', 2, int) |
203 | #define FS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr) | ||
204 | #define FS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr) | ||
172 | 205 | ||
173 | /* | 206 | /* |
174 | * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) | 207 | * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) |