[DRBD-cvs] r1646 - in trunk/drbd: . linux

svn at svn.drbd.org svn at svn.drbd.org
Tue Nov 16 20:28:53 CET 2004


Author: phil
Date: 2004-11-16 20:28:50 +0100 (Tue, 16 Nov 2004)
New Revision: 1646

Modified:
   trunk/drbd/drbd_main.c
   trunk/drbd/linux/drbd.h
Log:
Made state representation more consistent:

- In case we loose connection the disk_state falls back to Consistent
- The MDF_WasUpToDate is set as soon as disk_state is > Outdated 



Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2004-11-16 19:00:51 UTC (rev 1645)
+++ trunk/drbd/drbd_main.c	2004-11-16 19:28:50 UTC (rev 1646)
@@ -417,10 +417,13 @@
 	if( ns.i == os.i ) return 2;
 
 	/*  State sanitising  */
-	if( ns.s.conn < Connected ) ns.s.peer = Unknown;
-	if( ns.s.conn < Connected ) ns.s.pdsk = DUnknown;
+	if( ns.s.conn < Connected ) {
+		ns.s.peer = Unknown;
+		ns.s.pdsk = DUnknown;
+		if( ns.s.disk > Consistent ) ns.s.disk = Consistent;
+	}
 
-	if( ns.s.disk <= Failed && ns.s.conn > Connected) {
+	if( ns.s.conn > Connected && ns.s.disk <= Failed ) {
 		warn_sync_abort=1;
 		ns.s.conn = Connected;
 	}
@@ -467,6 +470,7 @@
 		}
 	}
 
+
 	if( !(flags & ChgStateHard) ) {
 		/*  pre-state-change checks ; only look at ns  */
 		/* See drbd_state_sw_errors in drbd_strings.c */
@@ -2005,7 +2009,7 @@
 	if (mdev->state.s.role == Primary)        flags |= MDF_PrimaryInd;
 	if (mdev->state.s.conn >= WFReportParams) flags |= MDF_ConnectedInd;
 	if (mdev->state.s.disk >  Inconsistent)   flags |= MDF_Consistent;
-	if (mdev->state.s.disk >= UpToDate)       flags |= MDF_WasUpToDate;
+	if (mdev->state.s.disk >  Outdated)       flags |= MDF_WasUpToDate;
 	mdev->gen_cnt[Flags] = flags;
 
 	for (i = Flags; i < GEN_CNT_SIZE; i++)

Modified: trunk/drbd/linux/drbd.h
===================================================================
--- trunk/drbd/linux/drbd.h	2004-11-16 19:00:51 UTC (rev 1645)
+++ trunk/drbd/linux/drbd.h	2004-11-16 19:28:50 UTC (rev 1646)
@@ -217,7 +217,8 @@
 		unsigned conn : 5 ;   // 17/32    cstates
 		unsigned disk : 3 ;   // 7/7      from DUnknown to UpToDate
 		unsigned pdsk : 3 ;   // 7/7      from DUnknown to UpToDate
-		unsigned _pad : 17;   // 0        unused
+		unsigned susp : 1 ;   // 2/2      IO suspended  no/yes
+		unsigned _pad : 16;   // 0        unused
 	} s;
 	unsigned int i;
 } drbd_state_t;



More information about the drbd-cvs mailing list