[DRBD-cvs] svn commit by phil - r2006 - in trunk/drbd: . linux - Shaked out some bugs:

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Thu Nov 17 22:08:34 CET 2005


* the new drbd_ioctl_set_net() wa
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: phil
Date: 2005-11-17 22:08:33 +0100 (Thu, 17 Nov 2005)
New Revision: 2006

Modified:
   trunk/drbd/drbd_fs.c
   trunk/drbd/drbd_int.h
   trunk/drbd/drbd_main.c
   trunk/drbd/linux/drbd.h
Log:
Shaked out some bugs:
* the new drbd_ioctl_set_net() was not correctly initializing
  the tl_hash and the ee_hash tables. Fixed.
* disk_mask of the dstates had the same value as UpToDate. Fixed.
* In the pre-state-change checks of _drbd_set_state() the new 
  if modified the semantics of the big if(){} else if() {} construct.
  Fixed.
* Removed an reference to mdev->bc from drbd_mdev_cleanup()
* Made drbd_md_set_sector_offsets() a bit less verbose.


Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2005-11-15 15:39:20 UTC (rev 2005)
+++ trunk/drbd/drbd_fs.c	2005-11-17 21:08:33 UTC (rev 2006)
@@ -531,7 +531,7 @@
 STATIC
 int drbd_ioctl_set_net(struct Drbd_Conf *mdev, struct ioctl_net_config * arg)
 {
-	int i,minor;
+	int i,minor,ns;
 	enum ret_codes retcode;
 	struct net_config *new_conf = NULL;
 	struct crypto_tfm* tfm = NULL;
@@ -591,25 +591,24 @@
 	}
 
 
-	if (mdev->tl_hash_s != new_conf->max_epoch_size/8 ) {
-		new_tl_hash=kmalloc((new_conf->max_epoch_size/8)*sizeof(void*),
-				    GFP_KERNEL);
+	ns = new_conf->max_epoch_size/8;
+	if (mdev->tl_hash_s != ns) {
+		new_tl_hash=kmalloc(ns*sizeof(void*), GFP_KERNEL);
 		if(!new_tl_hash) {
 			retcode=KMallocFailed;
 			goto fail_ioctl;
 		}
-		memset(new_tl_hash, 0, mdev->tl_hash_s * sizeof(void*));
+		memset(new_tl_hash, 0, ns*sizeof(void*));
 	}
 
-	if (new_conf->two_primaries &&
-	    ( mdev->ee_hash_s != new_conf->max_buffers/8 ) ) {
-		new_ee_hash=kmalloc((new_conf->max_buffers/8)*sizeof(void*),
-				    GFP_KERNEL);
+	ns = new_conf->max_buffers/8;
+	if (new_conf->two_primaries && ( mdev->ee_hash_s != ns ) ) {
+		new_ee_hash=kmalloc(ns*sizeof(void*), GFP_KERNEL);
 		if(!new_ee_hash) {
 			retcode=KMallocFailed;
 			goto fail_ioctl;
 		}
-		memset(new_ee_hash, 0, mdev->ee_hash_s * sizeof(void*));
+		memset(new_ee_hash, 0, ns*sizeof(void*));
 	}
 
 	/* IMPROVE:

Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2005-11-15 15:39:20 UTC (rev 2005)
+++ trunk/drbd/drbd_int.h	2005-11-17 21:08:33 UTC (rev 2006)
@@ -1329,13 +1329,9 @@
 #warning FIXME max size check missing.
 		/* we need (slightly less than) ~ this much bitmap sectors: */
 		md_size_sect = drbd_get_capacity(bdev->backing_bdev);
-		DUMPI(md_size_sect);
 		md_size_sect = ALIGN(md_size_sect,BM_SECT_PER_EXT);
-		DUMPI(md_size_sect);
 		md_size_sect = BM_SECT_TO_EXT(md_size_sect);
-		DUMPI(md_size_sect);
 		md_size_sect = ALIGN(md_size_sect,8);
-		DUMPI(md_size_sect);
 
 		/* plus the "drbd meta data super block",
 		 * and the activity log; */
@@ -1346,10 +1342,6 @@
 		bdev->md.bm_offset   = -md_size_sect + MD_AL_OFFSET;
 		break;
 	}
-	DUMPI(bdev->md.md_offset);
-	DUMPI(bdev->md.al_offset);
-	DUMPI(bdev->md.bm_offset);
-	DUMPI(md_size_sect);
 }
 
 static inline void

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2005-11-15 15:39:20 UTC (rev 2005)
+++ trunk/drbd/drbd_main.c	2005-11-17 21:08:33 UTC (rev 2006)
@@ -636,6 +636,7 @@
 			dec_net(mdev);
 		}
 
+		if( rv <= 0 ) /* already found a reason to abort */;
 		else if( ns.role == Primary && ns.conn < Connected &&
 			 ns.disk <= Outdated ) rv=-2;
 
@@ -1831,7 +1832,6 @@
 	mdev->recv_cnt     =
 	mdev->send_cnt     =
 	mdev->writ_cnt     =
-	mdev->bc->md.la_size_sect      =
 	mdev->p_size       =
 	mdev->rs_start     =
 	mdev->rs_total     =

Modified: trunk/drbd/linux/drbd.h
===================================================================
--- trunk/drbd/linux/drbd.h	2005-11-15 15:39:20 UTC (rev 2005)
+++ trunk/drbd/linux/drbd.h	2005-11-17 21:08:33 UTC (rev 2006)
@@ -235,7 +235,7 @@
 	DUnknown,
 	Consistent,     /* Might be Outdated, might be UpToDate ... */
 	UpToDate,
-	disk_mask=7
+	disk_mask=15
 } drbd_disks_t;
 
 typedef union {
@@ -243,13 +243,13 @@
 		unsigned role : 2 ;   // 3/4      primary/secondary/unknown
 		unsigned peer : 2 ;   // 3/4      primary/secondary/unknown
 		unsigned conn : 5 ;   // 17/32    cstates
-		unsigned disk : 3 ;   // 7/8      from Diskless to UpToDate
-		unsigned pdsk : 3 ;   // 7/8      from Diskless to UpToDate
+		unsigned disk : 4 ;   // 8/16     from Diskless to UpToDate
+		unsigned pdsk : 4 ;   // 8/16     from Diskless to UpToDate
 		unsigned susp : 1 ;   // 2/2      IO suspended  no/yes
 		unsigned aftr_isp : 1 ; // isp .. imposed sync pause
 		unsigned peer_isp : 1 ;
 		unsigned user_isp : 1 ; 
-		unsigned _pad : 13;   // 0        unused
+		unsigned _pad : 11;   // 0        unused
 	};
 	unsigned int i;
 } drbd_state_t;



More information about the drbd-cvs mailing list