fix kernel compatible of sle15sp1, bsc#1116820. OBS-URL: https://build.opensuse.org/request/show/650582 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/drbd?expand=0&rev=78
84 lines
2.4 KiB
Diff
84 lines
2.4 KiB
Diff
diff -Naur drbd-9.0.16+git.ab9777df.orig/drbd/drbd-kernel-compat/drbd_wrappers.h drbd-9.0.16+git.ab9777df/drbd/drbd-kernel-compat/drbd_wrappers.h
|
|
--- drbd-9.0.16+git.ab9777df.orig/drbd/drbd-kernel-compat/drbd_wrappers.h 2018-11-21 16:42:49.173926025 +0800
|
|
+++ drbd-9.0.16+git.ab9777df/drbd/drbd-kernel-compat/drbd_wrappers.h 2018-11-21 16:44:33.373769980 +0800
|
|
@@ -1348,8 +1348,11 @@
|
|
#endif
|
|
|
|
#ifndef COMPAT_HAVE_BIOSET_INIT
|
|
+
|
|
+#ifndef COMPAT_HAVE_MEMPOOL_INIT
|
|
#define mempool_free(V, P) mempool_free(V, *P)
|
|
#define mempool_alloc(P, F) mempool_alloc(*P, F)
|
|
+#endif
|
|
|
|
#ifndef COMPAT_HAVE_BIO_CLONE_FAST
|
|
# define bio_clone_fast(bio, gfp, bio_set) bio_clone(bio, gfp)
|
|
@@ -1358,7 +1361,13 @@
|
|
#endif
|
|
|
|
#define bio_alloc_bioset(GFP, n, P) bio_alloc_bioset(GFP, n, *P)
|
|
+
|
|
+#ifndef COMPAT_HAVE_MEMPOOL_INIT
|
|
#define DRBD_MEMPOOL_T mempool_t *
|
|
+#else
|
|
+#define DRBD_MEMPOOL_T mempool_t
|
|
+#endif
|
|
+
|
|
#define DRBD_BIO_SET bio_set *
|
|
static inline void bioset_exit(struct bio_set **bs)
|
|
{
|
|
@@ -1367,6 +1376,8 @@
|
|
*bs = NULL;
|
|
}
|
|
}
|
|
+
|
|
+#ifndef COMPAT_HAVE_MEMPOOL_INIT
|
|
static inline void mempool_exit(mempool_t **p)
|
|
{
|
|
if (*p) {
|
|
@@ -1374,6 +1385,8 @@
|
|
*p = NULL;
|
|
}
|
|
}
|
|
+#endif
|
|
+
|
|
#if defined(COMPAT_HAVE_BIOSET_NEED_BVECS)
|
|
#define bioset_init(BS, S, FP, F) __bioset_init(BS, S, FP, F)
|
|
#else
|
|
@@ -1385,6 +1398,8 @@
|
|
*bs = bioset_create(size, front_pad, flags);
|
|
return *bs == NULL ? -ENOMEM : 0;
|
|
}
|
|
+
|
|
+#ifndef COMPAT_HAVE_MEMPOOL_INIT
|
|
static inline int
|
|
mempool_init_page_pool(mempool_t **pool, int min_nr, int order)
|
|
{
|
|
@@ -1397,6 +1412,8 @@
|
|
*pool = mempool_create_slab_pool(min_nr, mem_cache);
|
|
return *pool == NULL ? -ENOMEM : 0;
|
|
}
|
|
+#endif
|
|
+
|
|
static inline bool
|
|
bioset_initialized(struct bio_set **bs)
|
|
{
|
|
diff -Naur drbd-9.0.16+git.ab9777df.orig/drbd/drbd-kernel-compat/tests/have_mempool_init.c drbd-9.0.16+git.ab9777df/drbd/drbd-kernel-compat/tests/have_mempool_init.c
|
|
--- drbd-9.0.16+git.ab9777df.orig/drbd/drbd-kernel-compat/tests/have_mempool_init.c 1970-01-01 08:00:00.000000000 +0800
|
|
+++ drbd-9.0.16+git.ab9777df/drbd/drbd-kernel-compat/tests/have_mempool_init.c 2018-11-21 16:43:42.429846044 +0800
|
|
@@ -0,0 +1,14 @@
|
|
+#include <linux/mempool.h>
|
|
+/*
|
|
+With linux v4.18 mempool_init get embedded
|
|
+commit c1a67fefd0546a5552289c65fe31b1d60e64b643
|
|
+Author: Kent Overstreet <kent.overstreet@gmail.com>
|
|
+Date: Mon May 4 16:52:20 2015 -0700
|
|
+*/
|
|
+
|
|
+static int foo(void)
|
|
+{
|
|
+ struct mempool_s mempool_t;
|
|
+
|
|
+ return mempool_init_page_pool(&mempool_t, 0, 0);
|
|
+}
|