]> git.pld-linux.org Git - packages/zfs.git/blob - kernel-5.8.patch
- fix building with kernel 5.8
[packages/zfs.git] / kernel-5.8.patch
1 diff -urN zfs-0.8.4/config/kernel-kmem.m4 zfs-0.8.4-5.8/config/kernel-kmem.m4
2 --- zfs-0.8.4/config/kernel-kmem.m4     1970-01-01 01:00:00.000000000 +0100
3 +++ zfs-0.8.4-5.8/config/kernel-kmem.m4 2020-08-16 20:47:36.079945075 +0200
4 @@ -0,0 +1,24 @@
5 +dnl #
6 +dnl # 5.8 API,
7 +dnl # __vmalloc PAGE_KERNEL removal
8 +dnl #
9 +AC_DEFUN([ZFS_AC_KERNEL_SRC_VMALLOC_PAGE_KERNEL], [
10 +       ZFS_LINUX_TEST_SRC([__vmalloc], [
11 +               #include <linux/mm.h>
12 +               #include <linux/vmalloc.h>
13 +       ],[
14 +               void *p __attribute__ ((unused));
15 +
16 +               p = __vmalloc(0, GFP_KERNEL, PAGE_KERNEL);
17 +       ])
18 +])
19 +
20 +AC_DEFUN([ZFS_AC_KERNEL_VMALLOC_PAGE_KERNEL], [
21 +       AC_MSG_CHECKING([whether __vmalloc(ptr, flags, pageflags) is available])
22 +       ZFS_LINUX_TEST_RESULT([__vmalloc], [
23 +               AC_MSG_RESULT(yes)
24 +               AC_DEFINE(HAVE_VMALLOC_PAGE_KERNEL, 1, [__vmalloc page flags exists])
25 +       ],[
26 +               AC_MSG_RESULT(no)
27 +       ])
28 +])
29 diff -ur zfs-0.8.4/aclocal.m4 zfs-0.8.4-5.8/aclocal.m4
30 --- zfs-0.8.4/aclocal.m4        2020-05-05 18:56:50.832844255 +0200
31 +++ zfs-0.8.4-5.8/aclocal.m4    2020-08-16 20:47:51.756613733 +0200
32 @@ -1503,6 +1503,7 @@
33  m4_include([config/kernel-invalidate-bdev-args.m4])
34  m4_include([config/kernel-is_owner_or_cap.m4])
35  m4_include([config/kernel-kmap-atomic-args.m4])
36 +m4_include([config/kernel-kmem.m4])
37  m4_include([config/kernel-kmem-cache.m4])
38  m4_include([config/kernel-kstrtoul.m4])
39  m4_include([config/kernel-ktime.m4])
40 diff -ur zfs-0.8.4/config/kernel.m4 zfs-0.8.4-5.8/config/kernel.m4
41 --- zfs-0.8.4/config/kernel.m4  2020-08-16 20:52:32.199984184 +0200
42 +++ zfs-0.8.4-5.8/config/kernel.m4      2020-08-16 20:48:47.436620888 +0200
43 @@ -45,6 +45,7 @@
44         ZFS_AC_KERNEL_SRC_SCHED
45         ZFS_AC_KERNEL_SRC_USLEEP_RANGE
46         ZFS_AC_KERNEL_SRC_KMEM_CACHE
47 +       ZFS_AC_KERNEL_SRC_VMALLOC_PAGE_KERNEL
48         ZFS_AC_KERNEL_SRC_WAIT
49         ZFS_AC_KERNEL_SRC_INODE_TIMES
50         ZFS_AC_KERNEL_SRC_INODE_LOCK
51 @@ -163,6 +164,7 @@
52         ZFS_AC_KERNEL_SCHED
53         ZFS_AC_KERNEL_USLEEP_RANGE
54         ZFS_AC_KERNEL_KMEM_CACHE
55 +       ZFS_AC_KERNEL_VMALLOC_PAGE_KERNEL
56         ZFS_AC_KERNEL_WAIT
57         ZFS_AC_KERNEL_INODE_TIMES
58         ZFS_AC_KERNEL_INODE_LOCK
59 diff -ur zfs-0.8.4/include/spl/sys/kmem.h zfs-0.8.4-5.8/include/spl/sys/kmem.h
60 --- zfs-0.8.4/include/spl/sys/kmem.h    2020-05-05 18:56:29.717370676 +0200
61 +++ zfs-0.8.4-5.8/include/spl/sys/kmem.h        2020-08-16 20:49:25.949959237 +0200
62 @@ -170,6 +170,15 @@
63  extern void spl_kmem_free(const void *ptr, size_t sz);
64  
65  /*
66 + * 5.8 API change, pgprot_t argument removed.
67 + */
68 +#ifdef HAVE_VMALLOC_PAGE_KERNEL
69 +#define        spl_vmalloc(size, flags)        __vmalloc(size, flags, PAGE_KERNEL)
70 +#else
71 +#define        spl_vmalloc(size, flags)        __vmalloc(size, flags)
72 +#endif
73 +
74 +/*
75   * The following functions are only available for internal use.
76   */
77  extern void *spl_kmem_alloc_impl(size_t size, int flags, int node);
78 diff -ur zfs-0.8.4/module/spl/spl-kmem.c zfs-0.8.4-5.8/module/spl/spl-kmem.c
79 --- zfs-0.8.4/module/spl/spl-kmem.c     2020-05-05 18:57:28.442960922 +0200
80 +++ zfs-0.8.4-5.8/module/spl/spl-kmem.c 2020-08-16 20:52:08.019980890 +0200
81 @@ -172,16 +171,15 @@
82                  * kmem_zalloc() callers.
83                  *
84                  * For vmem_alloc() and vmem_zalloc() callers it is permissible
85 -                * to use __vmalloc().  However, in general use of __vmalloc()
86 -                * is strongly discouraged because a global lock must be
87 -                * acquired.  Contention on this lock can significantly
88 +                * to use spl_vmalloc().  However, in general use of
89 +                * spl_vmalloc() is strongly discouraged because a global lock
90 +                * must be acquired.  Contention on this lock can significantly
91                  * impact performance so frequently manipulating the virtual
92                  * address space is strongly discouraged.
93                  */
94                 if ((size > spl_kmem_alloc_max) || use_vmem) {
95                         if (flags & KM_VMEM) {
96 -                               ptr = __vmalloc(size, lflags | __GFP_HIGHMEM,
97 -                                   PAGE_KERNEL);
98 +                               ptr = spl_vmalloc(size, lflags | __GFP_HIGHMEM);
99                         } else {
100                                 return (NULL);
101                         }
102 diff -ur zfs-0.8.4/module/spl/spl-kmem-cache.c zfs-0.8.4-5.8/module/spl/spl-kmem-cache.c
103 --- zfs-0.8.4/module/spl/spl-kmem-cache.c       2020-05-05 18:57:28.442960922 +0200
104 +++ zfs-0.8.4-5.8/module/spl/spl-kmem-cache.c   2020-08-16 20:50:28.763300871 +0200
105 @@ -203,7 +203,7 @@
106                 ASSERT(ISP2(size));
107                 ptr = (void *)__get_free_pages(lflags, get_order(size));
108         } else {
109 -               ptr = __vmalloc(size, lflags | __GFP_HIGHMEM, PAGE_KERNEL);
110 +               ptr = spl_vmalloc(size, lflags | __GFP_HIGHMEM);
111         }
112  
113         /* Resulting allocated memory will be page aligned */
114 @@ -1242,7 +1242,7 @@
115          * allocation.
116          *
117          * However, this can't be applied to KVM_VMEM due to a bug that
118 -        * __vmalloc() doesn't honor gfp flags in page table allocation.
119 +        * spl_vmalloc() doesn't honor gfp flags in page table allocation.
120          */
121         if (!(skc->skc_flags & KMC_VMEM)) {
122                 rc = __spl_cache_grow(skc, flags | KM_NOSLEEP);
This page took 0.042582 seconds and 3 git commands to generate.