[DRBD-cvs] svn commit by phil - r2079 - in trunk: . drbd user - Propagated most of the changes from the 07 branch to th

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Fri Feb 24 12:43:11 CET 2006


Author: phil
Date: 2006-02-24 12:43:09 +0100 (Fri, 24 Feb 2006)
New Revision: 2079

Modified:
   trunk/
   trunk/drbd/drbd_actlog.c
   trunk/drbd/drbd_fs.c
   trunk/drbd/drbd_int.h
   trunk/drbd/drbd_receiver.c
   trunk/user/drbdadm_main.c
   trunk/user/drbdadm_usage_cnt.c
Log:
Propagated most of the changes from the 07 branch to the trunk.



Property changes on: trunk
___________________________________________________________________
Name: propagate:at
   - 2040
   + 2068

Modified: trunk/drbd/drbd_actlog.c
===================================================================
--- trunk/drbd/drbd_actlog.c	2006-02-23 17:46:28 UTC (rev 2078)
+++ trunk/drbd/drbd_actlog.c	2006-02-24 11:43:09 UTC (rev 2079)
@@ -162,8 +162,15 @@
 	unsigned int enr;
 };
 
-STATIC void drbd_al_write_transaction(struct Drbd_Conf *,struct lc_element *,
-				      unsigned int );
+struct update_al_work {
+	struct drbd_work w;
+	struct lc_element * al_ext;
+	struct completion event;
+	unsigned int enr;
+};
+
+STATIC int w_al_write_transaction(struct Drbd_Conf *, struct drbd_work *, int);
+
 static inline
 struct lc_element* _al_get(struct Drbd_Conf *mdev, unsigned int enr)
 {
@@ -200,6 +207,7 @@
 {
 	unsigned int enr = (sector >> (AL_EXTENT_SIZE_B-9));
 	struct lc_element *al_ext;
+	struct update_al_work al_work;
 
 	D_ASSERT(atomic_read(&mdev->local_cnt)>0);
 	wait_event(mdev->al_wait, (al_ext = _al_get(mdev,enr)) );
@@ -213,7 +221,19 @@
 		if(mdev->state.conn < Connected && evicted != LC_FREE ) {
 			drbd_bm_write_sect(mdev, evicted/AL_EXT_PER_BM_SECT );
 		}
-		drbd_al_write_transaction(mdev,al_ext,enr);
+
+		/* drbd_al_write_transaction(mdev,al_ext,enr);
+		   generic_make_request() are serialized on the 
+		   current->bio_tail list now. Therefore we have
+		   to deligate writing something to AL to the
+		   worker thread. */
+		init_completion(&al_work.event);
+		al_work.al_ext = al_ext;
+		al_work.enr = enr;
+		al_work.w.cb = w_al_write_transaction;
+		drbd_queue_work_front(mdev,&mdev->data.work,&al_work.w);
+		wait_for_completion(&al_work.event);
+		
 		mdev->al_writ_cnt++;
 
 		/*
@@ -250,9 +270,8 @@
 	spin_unlock_irqrestore(&mdev->al_lock,flags);
 }
 
-STATIC void
-drbd_al_write_transaction(struct Drbd_Conf *mdev,struct lc_element *updated,
-			  unsigned int new_enr)
+STATIC int
+w_al_write_transaction(struct Drbd_Conf *mdev, struct drbd_work *w, int unused)
 {
 	int i,n,mx;
 	unsigned int extent_nr;
@@ -260,6 +279,9 @@
 	sector_t sector;
 	u32 xor_sum=0;
 
+	struct lc_element *updated = ((struct update_al_work*)w)->al_ext;
+	unsigned int new_enr = ((struct update_al_work*)w)->enr;
+
 	down(&mdev->md_io_mutex); // protects md_io_buffer, al_tr_cycle, ...
 	buffer = (struct al_transaction*)page_address(mdev->md_io_page);
 
@@ -311,6 +333,10 @@
 	mdev->al_tr_number++;
 
 	up(&mdev->md_io_mutex);
+
+	complete(&((struct update_al_work*)w)->event);
+
+	return 1;
 }
 
 STATIC int drbd_al_read_tr(struct Drbd_Conf *mdev,

Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2006-02-23 17:46:28 UTC (rev 2078)
+++ trunk/drbd/drbd_fs.c	2006-02-24 11:43:09 UTC (rev 2079)
@@ -120,10 +120,13 @@
 	}
 
 	if ( la_size_changed || md_moved ) {
-		drbd_al_shrink(mdev); // All extents inactive.
-		drbd_bm_write(mdev);  // write bitmap
-		// Write mdev->bc->md.la_size_sect to [possibly new position on] disk.
-		drbd_md_mark_dirty(mdev);
+		if( inc_local_md_only(mdev)) {
+			drbd_al_shrink(mdev); // All extents inactive.
+			drbd_bm_write(mdev);  // write bitmap
+			// Write mdev->la_size to on disk.
+			drbd_md_mark_dirty(mdev);
+			dec_local(mdev);
+		}
 	}
   out:
 	lc_unlock(mdev->act_log);
@@ -472,6 +475,27 @@
 	 * drbd_set_recv_tcq(mdev,drbd_queue_order_type(mdev)==QUEUE_ORDERED_TAG);
 	 */
 
+	/* If I am currently not Primary,
+	 * but meta data primary indicator is set,
+	 * I just now recover from a hard crash,
+	 * and have been Primary before that crash.
+	 *
+	 * Now, if I had no connection before that crash
+	 * (have been degraded Primary), chances are that
+	 * I won't find my peer now either.
+	 *
+	 * In that case, and _only_ in that case,
+	 * we use the degr-wfc-timeout instead of the default,
+	 * so we can automatically recover from a crash of a
+	 * degraded but active "cluster" after a certain timeout.
+	 */
+	clear_bit(USE_DEGR_WFC_T,&mdev->flags);
+	if ( mdev->state != Primary &&
+	     drbd_md_test_flag(mdev,MDF_PrimaryInd) &&
+	    !drbd_md_test_flag(mdev,MDF_ConnectedInd) ) {
+		set_bit(USE_DEGR_WFC_T,&mdev->flags);
+	}
+
 	drbd_bm_lock(mdev); // racy...
 	drbd_determin_dev_size(mdev);
 
@@ -919,24 +943,7 @@
 	if(copy_from_user(&p,arg,sizeof(p))) {
 		return -EFAULT;
 	}
-
-	/* If I am currently not Primary,
-	 * but meta data primary indicator is set,
-	 * I just now recover from a hard crash,
-	 * and have been Primary before that crash.
-	 *
-	 * Now, if I had no connection before that crash
-	 * (have been degraded Primary), chances are that
-	 * I won't find my peer now either.
-	 *
-	 * In that case, and _only_ in that case,
-	 * we use the degr-wfc-timeout instead of the default,
-	 * so we can automatically recover from a crash of a
-	 * degraded but active "cluster" after a certain timeout.
-	 */
-	if ( mdev->state.role != Primary &&
-	     drbd_md_test_flag(mdev,MDF_PrimaryInd) &&
-	    !drbd_md_test_flag(mdev,MDF_ConnectedInd) ) {
+	if ( test_bit(USE_DEGR_WFC_T,&mdev->flags) ) {
 		time=p.degr_wfc_timeout;
 		if (time) WARN("using degr_wfc_timeout=%ld seconds\n", time);
 	} else {

Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2006-02-23 17:46:28 UTC (rev 2078)
+++ trunk/drbd/drbd_int.h	2006-02-24 11:43:09 UTC (rev 2079)
@@ -637,6 +637,7 @@
 	SYNC_STARTED,		// Needed to agree on the exact point in time..
 	UNIQUE,                 // Set on one node, cleared on the peer!
 	SPLIT_BRAIN_FIX,        // Set if split-brain-fix is configured
+	USE_DEGR_WFC_T		// Use degr-wfc-timeout instead of wfc-timeout.
 };
 
 struct drbd_bitmap; // opaque for Drbd_Conf

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2006-02-23 17:46:28 UTC (rev 2078)
+++ trunk/drbd/drbd_receiver.c	2006-02-24 11:43:09 UTC (rev 2079)
@@ -38,6 +38,7 @@
 #include <linux/version.h>
 #include <linux/fs.h>
 #include <linux/file.h>
+#include <linux/in.h>
 #include <linux/mm.h>
 #include <linux/drbd_config.h>
 #include <linux/mm_inline.h>
@@ -731,6 +732,7 @@
 	drbd_send_sizes(mdev);
 	drbd_send_uuids(mdev);
 	drbd_send_state(mdev);
+	clear_bit(USE_DEGR_WFC_T,&mdev->flags);
 
 	return 1;
 }

Modified: trunk/user/drbdadm_main.c
===================================================================
--- trunk/user/drbdadm_main.c	2006-02-23 17:46:28 UTC (rev 2078)
+++ trunk/user/drbdadm_main.c	2006-02-24 11:43:09 UTC (rev 2079)
@@ -323,8 +323,11 @@
 static int sh_resources(struct d_resource* ignored __attribute((unused)),const char* unused __attribute((unused)))
 {
   struct d_resource *res,*t;
+  int first=1;
+
   for_each_resource(res,t,config) {
-    printf(res==config?"%s":" %s",esc(res->name));
+    printf(first?"%s":" %s",esc(res->name));
+    first=0;
   }
   printf("\n");
 

Modified: trunk/user/drbdadm_usage_cnt.c
===================================================================
--- trunk/user/drbdadm_usage_cnt.c	2006-02-23 17:46:28 UTC (rev 2078)
+++ trunk/user/drbdadm_usage_cnt.c	2006-02-24 11:43:09 UTC (rev 2079)
@@ -464,7 +464,7 @@
 "\t\t--== Creating metadata ==--\n"
 "As with nodes we count the total number of devices mirrored by DRBD at\n"
 "at http://"HTTP_HOST".\n\n"
-"The conter works completely anonymous. A random number gets created for\n"
+"The counter works completely anonymous. A random number gets created for\n"
 "this device, and that randomer number and the devices size will be sent.\n\n"
 "http://"HTTP_HOST"/cgi-bin/insert_usage.pl?nu="U64"&ru="U64"&rs="U64"\n\n"
 "Enter 'no' to opt out, or just press [return] to continue:",



More information about the drbd-cvs mailing list