[DRBD-cvs] svn commit by lars - r2979 - branches/drbd-8.0-for-linus/drbd - equivalent of: DRBD: added DRBD_MAJOR to linux/major.h;

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Mon Jul 23 17:51:46 CEST 2007


Author: lars
Date: 2007-07-23 17:51:45 +0200 (Mon, 23 Jul 2007)
New Revision: 2979

Modified:
   branches/drbd-8.0-for-linus/drbd/drbd_int.h
   branches/drbd-8.0-for-linus/drbd/drbd_main.c
   branches/drbd-8.0-for-linus/drbd/drbd_nl.c
   branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
   branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h
Log:
equivalent of: DRBD: added DRBD_MAJOR to linux/major.h; cleanup; ca60be259a731f7c43219728c2751131438fee20

Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-23 14:16:14 UTC (rev 2978)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-23 15:51:45 UTC (rev 2979)
@@ -42,8 +42,6 @@
 // module parameter, defined in drbd_main.c
 extern int minor_count;
 extern int allow_oos;
-extern int major_nr;
-extern int use_nbd_major;
 
 #ifdef DRBD_ENABLE_FAULTS
 extern int enable_faults;
@@ -54,13 +52,12 @@
 extern char usermode_helper[];
 
 #include <linux/major.h>
-#ifdef DRBD_MAJOR
-# warning "FIXME. DRBD_MAJOR is now officially defined in major.h"
+#ifndef DRBD_MAJOR
+# define DRBD_MAJOR 147
 #endif
 
 #include <linux/blkdev.h>
 #include <linux/bio.h>
-#define MAJOR_NR major_nr
 
 #undef DEVICE_NAME
 #define DEVICE_NAME "drbd"

Modified: branches/drbd-8.0-for-linus/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-23 14:16:14 UTC (rev 2978)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-23 15:51:45 UTC (rev 2979)
@@ -56,10 +56,6 @@
 #include "drbd_int.h"
 #include "drbd_req.h" /* only for _req_mod in tl_release and tl_clear */
 
-/* YES. We got an official device major from lanana
- */
-#define LANANA_DRBD_MAJOR 147
-
 struct after_state_chg_work {
 	struct drbd_work w;
 	drbd_state_t os;
@@ -104,9 +100,7 @@
 #endif
 
 // module parameter, defined
-int major_nr = LANANA_DRBD_MAJOR;
 int minor_count = 32;
-
 int allow_oos = 0;
 
 #ifdef ENABLE_DYNAMIC_TRACE
@@ -2302,7 +2296,7 @@
 
 	kfree(minor_table);
 
-	if (unregister_blkdev(MAJOR_NR, DEVICE_NAME) != 0)
+	if (unregister_blkdev(DRBD_MAJOR, DEVICE_NAME) != 0)
 		printk(KERN_ERR DEVICE_NAME": unregister of device failed\n");
 
 	printk(KERN_INFO DEVICE_NAME": module cleanup done.\n");
@@ -2334,14 +2328,14 @@
 	set_disk_ro( disk, TRUE );
 
 	disk->queue = q;
-	disk->major = MAJOR_NR;
+	disk->major = DRBD_MAJOR;
 	disk->first_minor = minor;
 	disk->fops = &drbd_ops;
 	sprintf(disk->disk_name, DEVICE_NAME "%d", minor);
 	disk->private_data = mdev;
 	add_disk(disk);
 
-	mdev->this_bdev = bdget(MKDEV(MAJOR_NR,minor));
+	mdev->this_bdev = bdget(MKDEV(DRBD_MAJOR,minor));
 	// we have no partitions. we contain only ourselves.
 	mdev->this_bdev->bd_contains = mdev->this_bdev;
 
@@ -2433,11 +2427,11 @@
 		return err;
 	}
 
-	err = register_blkdev(MAJOR_NR, DEVICE_NAME);
+	err = register_blkdev(DRBD_MAJOR, DEVICE_NAME);
 	if (err) {
 		printk(KERN_ERR DEVICE_NAME
 		       ": unable to register block device major %d\n",
-		       MAJOR_NR);
+		       DRBD_MAJOR);
 		return err;
 	}
 
@@ -2478,7 +2472,7 @@
 	       "Version: " REL_VERSION " (api:%d/proto:%d)\n",
 	       API_VERSION,PRO_VERSION);
 	printk(KERN_INFO DEVICE_NAME ": %s\n", drbd_buildtag());
-	printk(KERN_INFO DEVICE_NAME": registered as block device major %d\n", MAJOR_NR);
+	printk(KERN_INFO DEVICE_NAME": registered as block device major %d\n", DRBD_MAJOR);
 	printk(KERN_INFO DEVICE_NAME": minor_table @ 0x%p\n", minor_table);
 
 	return 0; // Success!

Modified: branches/drbd-8.0-for-linus/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-23 14:16:14 UTC (rev 2978)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-23 15:51:45 UTC (rev 2979)
@@ -29,6 +29,7 @@
 #include <linux/module.h>
 #include <linux/in.h>
 #include <linux/fs.h>
+#include <linux/buffer_head.h> /* for fsync_bdev */
 #include <linux/file.h>
 #include <linux/slab.h>
 #include <linux/connector.h>
@@ -303,7 +304,7 @@
 
 	if(forced) WARN("Forced to conisder local data as UpToDate!\n");
 
-	drbd_sync_me(mdev);
+	fsync_bdev(mdev->this_bdev);
 
 	/* Wait until nothing is on the fly :) */
 	if ( wait_event_interruptible( mdev->misc_wait,
@@ -1032,7 +1033,7 @@
 STATIC int drbd_nl_detach(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
 			  struct drbd_nl_cfg_reply *reply)
 {
-	drbd_sync_me(mdev);
+	fsync_bdev(mdev->this_bdev);
 	reply->ret_code = drbd_request_state(mdev,NS(disk,Diskless));
 
 	return 0;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-23 14:16:14 UTC (rev 2978)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-23 15:51:45 UTC (rev 2979)
@@ -872,10 +872,10 @@
 	int epoch_size=0;
 	Drbd_Barrier_Packet *p = (Drbd_Barrier_Packet*)h;
 
-	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
+	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return false;
 
 	rv = drbd_recv(mdev, h->payload, h->length);
-	ERR_IF(rv != h->length) return FALSE;
+	ERR_IF(rv != h->length) return false;
 
 	inc_unacked(mdev);
 

Modified: branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-23 14:16:14 UTC (rev 2978)
+++ branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-23 15:51:45 UTC (rev 2979)
@@ -1,7 +1,3 @@
-/*
- * FIXME this file is bound to die, renamed or included in drbd_int.h
- */
-
 #include <linux/version.h>
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 # error "use a 2.6 kernel, please"
@@ -17,8 +13,6 @@
 # define set_page_private(page, v)	((page)->private = (v))
 #endif
 
-#include <linux/buffer_head.h> // for fsync_bdev
-
 /* see get_sb_bdev and bd_claim */
 extern char* drbd_sec_holder;
 
@@ -51,11 +45,6 @@
 	mdev->this_bdev->bd_inode->i_size = (loff_t)size << 9;
 }
 
-static inline int drbd_sync_me(drbd_dev *mdev)
-{
-	return fsync_bdev(mdev->this_bdev);
-}
-
 #define drbd_bio_uptodate(bio) bio_flagged(bio,BIO_UPTODATE)
 
 #ifdef CONFIG_HIGHMEM



More information about the drbd-cvs mailing list