aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-01-22 13:54:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-22 13:54:13 -0500
commitd5ffdf8b4ac6e6db5702ba31870c476d5fa30660 (patch)
tree7c02b8c5de5dbab4d6c9fb2b6154a781818d83e7 /fs/xfs
parenteadee0ce6fd33defe449c97e671bf83fa230b5de (diff)
parentee3804d9f94c5a391c66386b70b9fe5a58775507 (diff)
Merge tag 'xfs-for-linus-4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs
Pull more xfs updates from Dave Chinner: "This is the second update for XFS that I mentioned in the original pull request last week. It contains a revert for a suspend regression in 4.4 and a fix for a long standing log recovery issue that has been further exposed by all the log recovery changes made in the original 4.5 merge. There is one more thing in this pull request - one that I forgot to merge into the origin. That is, pulling the XFS_IOC_FS[GS]ETXATTR ioctl up to the VFS level so that other filesystems can also use it for modifying project quota IDs Summary: - promotion of XFS_IOC_FS[GS]ETXATTR ioctl to the vfs level so that it can be shared with other filesystems. The ext4 project quota functionality is the first target for this. The commits in this series have not been updated with review or final SOB tags because the branch they were originally published in was needed by ext4. Those tags are: Reviewed-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Dave Chinner <david@fromrobit.com> - Revert a change that is causing suspend failures. - Fix a use-after-free that can occur on log mount failures. Been around forever, but now exposed by other changes to log recovery made in the first 4.5 merge" * tag 'xfs-for-linus-4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs: xfs: log mount failures don't wait for buffers to be released Revert "xfs: clear PF_NOFREEZE for xfsaild kthread" xfs: introduce per-inode DAX enablement xfs: use FS_XFLAG definitions directly fs: XFS_IOC_FS[SG]SETXATTR to FS_IOC_FS[SG]ETXATTR promotion
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_format.h11
-rw-r--r--fs/xfs/libxfs/xfs_fs.h38
-rw-r--r--fs/xfs/xfs_buf.c10
-rw-r--r--fs/xfs/xfs_inode.c60
-rw-r--r--fs/xfs/xfs_ioctl.c92
-rw-r--r--fs/xfs/xfs_iops.c4
-rw-r--r--fs/xfs/xfs_trans_ail.c1
7 files changed, 114 insertions, 102 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
42struct 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_buf.c b/fs/xfs/xfs_buf.c
index daed4bfb85b2..435c7de42e5f 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1527,6 +1527,16 @@ xfs_wait_buftarg(
1527 LIST_HEAD(dispose); 1527 LIST_HEAD(dispose);
1528 int loop = 0; 1528 int loop = 0;
1529 1529
1530 /*
1531 * We need to flush the buffer workqueue to ensure that all IO
1532 * completion processing is 100% done. Just waiting on buffer locks is
1533 * not sufficient for async IO as the reference count held over IO is
1534 * not released until after the buffer lock is dropped. Hence we need to
1535 * ensure here that all reference counts have been dropped before we
1536 * start walking the LRU list.
1537 */
1538 drain_workqueue(btp->bt_mount->m_buf_workqueue);
1539
1530 /* loop until there is nothing left on the lru list. */ 1540 /* loop until there is nothing left on the lru list. */
1531 while (list_lru_count(&btp->bt_lru)) { 1541 while (list_lru_count(&btp->bt_lru)) {
1532 list_lru_walk(&btp->bt_lru, xfs_buftarg_wait_rele, 1542 list_lru_walk(&btp->bt_lru, xfs_buftarg_wait_rele,
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
611STATIC uint 611STATIC 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
651uint 661uint
652xfs_ip2xflags( 662xfs_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
661uint 670uint
662xfs_dic2xflags( 671xfs_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
984STATIC void 995STATIC 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
1009static int 1025static 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 06eafafe636e..76b71a1c6c32 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -1205,8 +1205,8 @@ xfs_diflags_to_iflags(
1205 inode->i_flags |= S_SYNC; 1205 inode->i_flags |= S_SYNC;
1206 if (flags & XFS_DIFLAG_NOATIME) 1206 if (flags & XFS_DIFLAG_NOATIME)
1207 inode->i_flags |= S_NOATIME; 1207 inode->i_flags |= S_NOATIME;
1208 /* XXX: Also needs an on-disk per inode flag! */ 1208 if (ip->i_mount->m_flags & XFS_MOUNT_DAX ||
1209 if (ip->i_mount->m_flags & XFS_MOUNT_DAX) 1209 ip->i_d.di_flags2 & XFS_DIFLAG2_DAX)
1210 inode->i_flags |= S_DAX; 1210 inode->i_flags |= S_DAX;
1211} 1211}
1212 1212
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index aa67339b9537..4f18fd92ca13 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -497,7 +497,6 @@ xfsaild(
497 long tout = 0; /* milliseconds */ 497 long tout = 0; /* milliseconds */
498 498
499 current->flags |= PF_MEMALLOC; 499 current->flags |= PF_MEMALLOC;
500 set_freezable();
501 500
502 while (!kthread_should_stop()) { 501 while (!kthread_should_stop()) {
503 if (tout && tout <= 20) 502 if (tout && tout <= 20)