]> git.proxmox.com Git - zfsonlinux.git/blob - zfs-patches/0020-Linux-4.16-compat-inode_set_iversion.patch
update SPL to 0.7.7
[zfsonlinux.git] / zfs-patches / 0020-Linux-4.16-compat-inode_set_iversion.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Brian Behlendorf <behlendorf1@llnl.gov>
3 Date: Thu, 8 Feb 2018 14:27:59 -0800
4 Subject: [PATCH] Linux 4.16 compat: inode_set_iversion()
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 A new interface was added to manipulate the version field of an
10 inode. Add a inode_set_iversion() wrapper for older kernels and
11 use the new interface when available.
12
13 The i_version field was dropped from the trace point due to the
14 switch to an atomic64_t i_version type.
15
16 Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
17 Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
18 Reviewed-by: Chunwei Chen <david.chen@nutanix.com>
19 Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
20 Closes #7148
21 (cherry picked from commit 310e63dfd18f59ad583631dfa2f55d40cedf1415)
22 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
23 ---
24 include/linux/vfs_compat.h | 14 ++++++++++++++
25 include/sys/trace_acl.h | 6 ++----
26 module/zfs/zpl_super.c | 2 +-
27 config/kernel-inode-set-iversion.m4 | 19 +++++++++++++++++++
28 config/kernel.m4 | 1 +
29 5 files changed, 37 insertions(+), 5 deletions(-)
30 create mode 100644 config/kernel-inode-set-iversion.m4
31
32 diff --git a/include/linux/vfs_compat.h b/include/linux/vfs_compat.h
33 index 6111f0afc..f51ff887d 100644
34 --- a/include/linux/vfs_compat.h
35 +++ b/include/linux/vfs_compat.h
36 @@ -578,4 +578,18 @@ current_time(struct inode *ip)
37 }
38 #endif
39
40 +/*
41 + * 4.16 API change
42 + * Added iversion interface for managing inode version field.
43 + */
44 +#ifdef HAVE_INODE_SET_IVERSION
45 +#include <linux/iversion.h>
46 +#else
47 +static inline void
48 +inode_set_iversion(struct inode *ip, u64 val)
49 +{
50 + ip->i_version = val;
51 +}
52 +#endif
53 +
54 #endif /* _ZFS_VFS_H */
55 diff --git a/include/sys/trace_acl.h b/include/sys/trace_acl.h
56 index 1057e560b..610bbe29c 100644
57 --- a/include/sys/trace_acl.h
58 +++ b/include/sys/trace_acl.h
59 @@ -68,7 +68,6 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
60 __field(uint32_t, i_gid)
61 __field(unsigned long, i_ino)
62 __field(unsigned int, i_nlink)
63 - __field(u64, i_version)
64 __field(loff_t, i_size)
65 __field(unsigned int, i_blkbits)
66 __field(unsigned short, i_bytes)
67 @@ -103,7 +102,6 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
68 __entry->i_gid = KGID_TO_SGID(ZTOI(zn)->i_gid);
69 __entry->i_ino = zn->z_inode.i_ino;
70 __entry->i_nlink = zn->z_inode.i_nlink;
71 - __entry->i_version = zn->z_inode.i_version;
72 __entry->i_size = zn->z_inode.i_size;
73 __entry->i_blkbits = zn->z_inode.i_blkbits;
74 __entry->i_bytes = zn->z_inode.i_bytes;
75 @@ -121,7 +119,7 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
76 "mapcnt %llu size %llu pflags %llu "
77 "sync_cnt %u mode 0x%x is_sa %d "
78 "is_mapped %d is_ctldir %d is_stale %d inode { "
79 - "uid %u gid %u ino %lu nlink %u version %llu size %lli "
80 + "uid %u gid %u ino %lu nlink %u size %lli "
81 "blkbits %u bytes %u mode 0x%x generation %x } } "
82 "ace { type %u flags %u access_mask %u } mask_matched %u",
83 __entry->z_id, __entry->z_unlinked, __entry->z_atime_dirty,
84 @@ -131,7 +129,7 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
85 __entry->z_is_sa, __entry->z_is_mapped,
86 __entry->z_is_ctldir, __entry->z_is_stale, __entry->i_uid,
87 __entry->i_gid, __entry->i_ino, __entry->i_nlink,
88 - __entry->i_version, __entry->i_size, __entry->i_blkbits,
89 + __entry->i_size, __entry->i_blkbits,
90 __entry->i_bytes, __entry->i_mode, __entry->i_generation,
91 __entry->z_type, __entry->z_flags, __entry->z_access_mask,
92 __entry->mask_matched)
93 diff --git a/module/zfs/zpl_super.c b/module/zfs/zpl_super.c
94 index b6ef60277..25e75a897 100644
95 --- a/module/zfs/zpl_super.c
96 +++ b/module/zfs/zpl_super.c
97 @@ -36,7 +36,7 @@ zpl_inode_alloc(struct super_block *sb)
98 struct inode *ip;
99
100 VERIFY3S(zfs_inode_alloc(sb, &ip), ==, 0);
101 - ip->i_version = 1;
102 + inode_set_iversion(ip, 1);
103
104 return (ip);
105 }
106 diff --git a/config/kernel-inode-set-iversion.m4 b/config/kernel-inode-set-iversion.m4
107 new file mode 100644
108 index 000000000..9a7d7890e
109 --- /dev/null
110 +++ b/config/kernel-inode-set-iversion.m4
111 @@ -0,0 +1,19 @@
112 +dnl #
113 +dnl # 4.16 API change
114 +dnl # inode_set_iversion introduced to set i_version
115 +dnl #
116 +AC_DEFUN([ZFS_AC_KERNEL_INODE_SET_IVERSION], [
117 + AC_MSG_CHECKING([whether inode_set_iversion() exists])
118 + ZFS_LINUX_TRY_COMPILE([
119 + #include <linux/iversion.h>
120 + ],[
121 + struct inode inode;
122 + inode_set_iversion(&inode, 1);
123 + ],[
124 + AC_MSG_RESULT(yes)
125 + AC_DEFINE(HAVE_INODE_SET_IVERSION, 1,
126 + [inode_set_iversion() exists])
127 + ],[
128 + AC_MSG_RESULT(no)
129 + ])
130 +])
131 diff --git a/config/kernel.m4 b/config/kernel.m4
132 index b759ccd39..b83f021e8 100644
133 --- a/config/kernel.m4
134 +++ b/config/kernel.m4
135 @@ -65,6 +65,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
136 ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL
137 ZFS_AC_KERNEL_INODE_OPERATIONS_GETATTR
138 ZFS_AC_KERNEL_INODE_SET_FLAGS
139 + ZFS_AC_KERNEL_INODE_SET_IVERSION
140 ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE
141 ZFS_AC_KERNEL_SHOW_OPTIONS
142 ZFS_AC_KERNEL_FILE_INODE
143 --
144 2.14.2
145