[DRBD-cvs] svn commit by lars - r3027 - branches/drbd-8.0/drbd - fixes for linux 2.6.23 * r2983 | lars | 2007-07-24 10:4

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Mon Aug 27 21:29:57 CEST 2007


Author: lars
Date: 2007-08-27 21:29:55 +0200 (Mon, 27 Aug 2007)
New Revision: 3027

Modified:
   branches/drbd-8.0/drbd/drbd_compat_wrappers.h
   branches/drbd-8.0/drbd/drbd_int.h
   branches/drbd-8.0/drbd/drbd_main.c
Log:
fixes for linux 2.6.23
 * r2983 | lars | 2007-07-24 10:47:36 +0200
   8e628f935b8c66bf595449b41be12a966e9f20a0 DRBD: remove NULL contructor from kmem_cache_create invocations
   actually, introduce a new compatibility wrapper...


Modified: branches/drbd-8.0/drbd/drbd_compat_wrappers.h
===================================================================
--- branches/drbd-8.0/drbd/drbd_compat_wrappers.h	2007-08-27 10:16:34 UTC (rev 3026)
+++ branches/drbd-8.0/drbd/drbd_compat_wrappers.h	2007-08-27 19:29:55 UTC (rev 3027)
@@ -174,11 +174,23 @@
 #endif
 
 #ifdef USE_KMEM_CACHE_S
-typedef struct kmem_cache_s drbd_kmem_cache_t;
-#else
-typedef struct kmem_cache drbd_kmem_cache_t;
+#define kmem_cache kmem_cache_s
 #endif
 
+/* dtor was removed in 20c2df83d25c6a95affe6157a4c9cac4cf5ffaac
+ * on the way to 2.6.23 */
+static inline struct kmem_cache *
+drbd_kmem_cache_create (const char *name, size_t size, size_t align,
+        unsigned long flags,
+        void (*ctor)(void*, struct kmem_cache *, unsigned long))
+{
+	return kmem_cache_create(name, size, align, flags, ctor
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+		, NULL
+#endif
+		);
+}
+
 #ifdef NEED_BACKPORT_OF_ATOMIC_ADD
 
 #if defined(__x86_64__)

Modified: branches/drbd-8.0/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0/drbd/drbd_int.h	2007-08-27 10:16:34 UTC (rev 3026)
+++ branches/drbd-8.0/drbd/drbd_int.h	2007-08-27 19:29:55 UTC (rev 3027)
@@ -1168,8 +1168,8 @@
 #include "drbd_compat_wrappers.h"
 
 extern int minor_count;
-extern drbd_kmem_cache_t *drbd_request_cache;
-extern drbd_kmem_cache_t *drbd_ee_cache;
+extern struct kmem_cache *drbd_request_cache;
+extern struct kmem_cache *drbd_ee_cache;
 extern mempool_t *drbd_request_mempool;
 extern mempool_t *drbd_ee_mempool;
 

Modified: branches/drbd-8.0/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0/drbd/drbd_main.c	2007-08-27 10:16:34 UTC (rev 3026)
+++ branches/drbd-8.0/drbd/drbd_main.c	2007-08-27 19:29:55 UTC (rev 3027)
@@ -135,8 +135,8 @@
  */
 struct Drbd_Conf **minor_table = NULL;
 
-drbd_kmem_cache_t *drbd_request_cache;
-drbd_kmem_cache_t *drbd_ee_cache;
+struct kmem_cache *drbd_request_cache;
+struct kmem_cache *drbd_ee_cache;
 mempool_t *drbd_request_mempool;
 mempool_t *drbd_ee_mempool;
 
@@ -2161,15 +2161,15 @@
 	drbd_pp_pool         = NULL;
 
 	// caches
-	drbd_request_cache = kmem_cache_create(
+	drbd_request_cache = drbd_kmem_cache_create(
 		"drbd_req_cache", sizeof(drbd_request_t),
-		0, 0, NULL, NULL);
+		0, 0, NULL);
 	if (drbd_request_cache == NULL)
 		goto Enomem;
 
-	drbd_ee_cache = kmem_cache_create(
+	drbd_ee_cache = drbd_kmem_cache_create(
 		"drbd_ee_cache", sizeof(struct Tl_epoch_entry),
-		0, 0, NULL, NULL);
+		0, 0, NULL);
 	if (drbd_ee_cache == NULL)
 		goto Enomem;
 



More information about the drbd-cvs mailing list