drbd/compat_no_bioset_initialized.patch

46 lines
1.7 KiB
Diff

diff -Naur drbd-9.0.17~0rc1+git.e279913a.orig/drbd/drbd-kernel-compat/drbd_wrappers.h drbd-9.0.17~0rc1+git.e279913a/drbd/drbd-kernel-compat/drbd_wrappers.h
--- drbd-9.0.17~0rc1+git.e279913a.orig/drbd/drbd-kernel-compat/drbd_wrappers.h 2019-03-22 10:34:53.269720542 +0800
+++ drbd-9.0.17~0rc1+git.e279913a/drbd/drbd-kernel-compat/drbd_wrappers.h 2019-03-22 10:35:42.085701294 +0800
@@ -1397,14 +1397,23 @@
*pool = mempool_create_slab_pool(min_nr, mem_cache);
return *pool == NULL ? -ENOMEM : 0;
}
+#ifndef COMPAT_HAVE_BIOSET_INITIALIZED
static inline bool
bioset_initialized(struct bio_set **bs)
{
return *bs != NULL;
}
+#endif
#else
#define DRBD_MEMPOOL_T mempool_t
#define DRBD_BIO_SET bio_set
+#ifndef COMPAT_HAVE_BIOSET_INITIALIZED
+static inline bool
+bioset_initialized(struct bio_set *bs)
+{
+ return bs->bio_slab != NULL;
+}
+#endif
#endif
#if defined(COMPAT_BEFORE_4_13_KERNEL_READ)
diff -Naur drbd-9.0.17~0rc1+git.e279913a.orig/drbd/drbd-kernel-compat/tests/have_bioset_initialized.c drbd-9.0.17~0rc1+git.e279913a/drbd/drbd-kernel-compat/tests/have_bioset_initialized.c
--- drbd-9.0.17~0rc1+git.e279913a.orig/drbd/drbd-kernel-compat/tests/have_bioset_initialized.c 1970-01-01 08:00:00.000000000 +0800
+++ drbd-9.0.17~0rc1+git.e279913a/drbd/drbd-kernel-compat/tests/have_bioset_initialized.c 2019-03-22 10:36:08.333690886 +0800
@@ -0,0 +1,14 @@
+#include <linux/bio.h>
+/*
+With linux v4.18 biosets get embedded
+commit 917a38c71af82185c39e31589587591fa764fb85
+Author: Kent Overstreet <kent.overstreet@gmail.com>
+Date: Tue May 8 21:33:51 2018 -0400
+*/
+
+static inline bool foo(void)
+{
+ struct bio_set bio_set;
+
+ return bioset_initialized(&bio_set);
+}