[DRBD-cvs] svn commit by phil - r2323 - trunk/user - Various fixes to make "drbdadm adjust" work

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Tue Aug 1 15:34:57 CEST 2006


Author: phil
Date: 2006-08-01 15:34:56 +0200 (Tue, 01 Aug 2006)
New Revision: 2323

Modified:
   trunk/user/drbdadm_parser.c
   trunk/user/drbdsetup.c
Log:
Various fixes to make "drbdadm adjust" work


Modified: trunk/user/drbdadm_parser.c
===================================================================
--- trunk/user/drbdadm_parser.c	2006-08-01 12:45:09 UTC (rev 2322)
+++ trunk/user/drbdadm_parser.c	2006-08-01 13:34:56 UTC (rev 2323)
@@ -406,7 +406,17 @@
 			host->meta_disk = yylval.txt;
 			host->meta_index = strdup("flexible");
 			check_meta_disk(host);
-			EXP(';');
+			switch (yylex()) {
+			case TK__MAJOR:
+				EXP(TK_INTEGER);
+				host->meta_major = atoi(yylval.txt);
+				EXP(TK__MINOR);
+				EXP(TK_INTEGER);
+				host->meta_minor = atoi(yylval.txt);
+				EXP(';');
+			case ';':
+				break;
+			}
 			break;
 		case '}':
 			goto break_loop;

Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c	2006-08-01 12:45:09 UTC (rev 2322)
+++ trunk/user/drbdsetup.c	2006-08-01 13:34:56 UTC (rev 2323)
@@ -946,6 +946,7 @@
   struct ioctl_get_config current_cn;
   int err;
 
+  /*
   err=ioctl(drbd_fd,DRBD_IOCTL_GET_CONFIG,&current_cn);
   if(err)
     {
@@ -958,7 +959,14 @@
   cn.config.al_extents = current_cn.sconf.al_extents;
   cn.config.use_csums = 0; //current_cn.sconf.use_csums;
   cn.config.skip = 0; //current_cn.sconf.skip;
+  */
+  cn.config.rate = DEF_SYNC_RATE;
+  cn.config.after = DEF_SYNC_AFTER;
+  cn.config.al_extents = DEF_SYNC_AL_EXTENTS;
+  cn.config.use_csums = 0; //current_cn.sconf.use_csums;
+  cn.config.skip = 0; //current_cn.sconf.skip;
 
+
   if(argc > 0)
     {
       while(1)
@@ -1340,9 +1348,9 @@
 printf(";  \t# " U "\n")
 
 #define SHOW_IU(T,U1,U2,M,D) \
-printf("\t" T "\t%d",M); \
+printf("\t" T "\t%d"U1,M); \
 if(M==D) printf(" _is_default"); \
-printf(U1";  \t# " U2 "\n")
+printf(";  \t# " U2 "\n")
 
 #define SHOW_H(T,M,D,H) \
 printf("\t" T "\t%s",H[M]); \
@@ -1392,7 +1400,7 @@
       printf("}\n");
     }
 
-  if( cn.state.conn > StandAlone)
+  if( cn.state.disk > Diskless || cn.state.conn > StandAlone)
     {
       printf("syncer {\n");
       SHOW_IU("rate\t","K","(K)Byte/second", cn.sconf.rate, DEF_SYNC_RATE);
@@ -1401,10 +1409,7 @@
       if( cn.sconf.skip ) printf("\tskip-sync;\n");
       if( cn.sconf.use_csums ) printf("\tuse-csums;\n");
       printf("}\n");
-    }
 
-  if( cn.state.disk > Diskless || cn.state.conn > StandAlone)
-    {
       err=fstat(drbd_fd,&sb);
       if(err)
 	{
@@ -1423,12 +1428,20 @@
 	  cn.lower_device_minor == cn.meta_device_minor ) {
 	printf("\tmeta-disk\tinternal;\n");
       } else {
-	printf("\tmeta-disk\t\"%s\" [%d] _major %d _minor %d;\n",
-	       check_dev_name(cn.meta_device_name,cn.meta_device_major,
-			      cn.meta_device_minor),
-	       cn.meta_index,
-	       cn.meta_device_major,
-	       cn.meta_device_minor);
+	if( cn.meta_index == DRBD_MD_INDEX_FLEX_EXT ) {
+  	  printf("\tflexible-meta-disk\t\"%s\" _major %d _minor %d;\n",
+		 check_dev_name(cn.meta_device_name,cn.meta_device_major,
+				cn.meta_device_minor),
+		 cn.meta_device_major,
+		 cn.meta_device_minor);
+	} else {
+  	  printf("\tmeta-disk\t\"%s\" [%d] _major %d _minor %d;\n",
+		 check_dev_name(cn.meta_device_name,cn.meta_device_major,
+				cn.meta_device_minor),
+		 cn.meta_index,
+		 cn.meta_device_major,
+		 cn.meta_device_minor);
+	}
       }
 
       if( cn.state.conn > StandAlone) {



More information about the drbd-cvs mailing list