[DRBD-cvs] svn commit by lars - r2704 - trunk/drbd - fix for
page->[u.]private weirdness
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Wed Jan 17 18:04:17 CET 2007
Author: lars
Date: 2007-01-17 18:04:16 +0100 (Wed, 17 Jan 2007)
New Revision: 2704
Modified:
trunk/drbd/drbd_compat_wrappers.h
trunk/drbd/drbd_main.c
trunk/drbd/drbd_receiver.c
Log:
fix for page->[u.]private weirdness
Modified: trunk/drbd/drbd_compat_wrappers.h
===================================================================
--- trunk/drbd/drbd_compat_wrappers.h 2007-01-17 16:58:21 UTC (rev 2703)
+++ trunk/drbd/drbd_compat_wrappers.h 2007-01-17 17:04:16 UTC (rev 2704)
@@ -9,11 +9,12 @@
/* struct page has a union in 2.6.15 ...
- * an anonymous union and struct since 2.6.16 */
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16))
-#define U_PRIVATE private
-#else
-#define U_PRIVATE u.private
+ * an anonymous union and struct since 2.6.16
+ * or in fc5 "2.6.15" */
+#include <linux/mm.h>
+#ifndef page_private
+# define page_private(page) ((page)->private)
+# define set_page_private(page, v) ((page)->private = (v))
#endif
#include <linux/buffer_head.h> // for fsync_bdev
Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c 2007-01-17 16:58:21 UTC (rev 2703)
+++ trunk/drbd/drbd_main.c 2007-01-17 17:04:16 UTC (rev 2704)
@@ -2090,7 +2090,7 @@
while(drbd_pp_pool) {
page = drbd_pp_pool;
- drbd_pp_pool = (struct page*)page->U_PRIVATE;
+ drbd_pp_pool = (struct page*)page_private(page);
__free_page(page);
drbd_pp_vacant--;
}
@@ -2152,7 +2152,7 @@
for (i=0;i< number;i++) {
page = alloc_page(GFP_HIGHUSER);
if(!page) goto Enomem;
- page->U_PRIVATE = (unsigned long)drbd_pp_pool;
+ set_page_private(page,(unsigned long)drbd_pp_pool);
drbd_pp_pool = page;
}
drbd_pp_vacant = number;
Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c 2007-01-17 16:58:21 UTC (rev 2703)
+++ trunk/drbd/drbd_receiver.c 2007-01-17 17:04:16 UTC (rev 2704)
@@ -138,7 +138,7 @@
this is only called from drbd_alloc_ee,
and that is strictly process context! */
if ( (page = drbd_pp_pool) ) {
- drbd_pp_pool = (struct page*)page->U_PRIVATE;
+ drbd_pp_pool = (struct page*)page_private(page);
drbd_pp_vacant--;
}
spin_unlock_irqrestore(&drbd_pp_lock,flags);
@@ -152,7 +152,7 @@
/* try the pool again, maybe the drbd_kick_lo set some free */
spin_lock_irqsave(&drbd_pp_lock,flags);
if ( (page = drbd_pp_pool) ) {
- drbd_pp_pool = (struct page*)page->U_PRIVATE;
+ drbd_pp_pool = (struct page*)page_private(page);
drbd_pp_vacant--;
}
spin_unlock_irqrestore(&drbd_pp_lock,flags);
@@ -197,7 +197,7 @@
if (drbd_pp_vacant > (DRBD_MAX_SEGMENT_SIZE/PAGE_SIZE)*minor_count) {
free_it = 1;
} else {
- page->U_PRIVATE = (unsigned long)drbd_pp_pool;
+ set_page_private(page, (unsigned long)drbd_pp_pool);
drbd_pp_pool = page;
drbd_pp_vacant++;
free_it = 0;
More information about the drbd-cvs
mailing list