[DRBD-cvs] r1654 - in trunk: . user

svn at svn.drbd.org svn at svn.drbd.org
Wed Nov 24 14:44:51 CET 2004


Author: phil
Date: 2004-11-24 14:44:48 +0100 (Wed, 24 Nov 2004)
New Revision: 1654

Modified:
   trunk/
   trunk/ChangeLog
   trunk/user/drbdadm_adjust.c
   trunk/user/drbdadm_main.c
Log:
svnp run. Investigated 1639 to 1654

r1642 by phil on 2004-11-16 16:55:31 +0100 (Tue, 16 Nov 2004) 
  Changed paths:
     M /branches/drbd-0.7/user/drbdadm_adjust.c
     M /branches/drbd-0.7/user/drbdadm_main.c
  
  Changed the order in which drbdadm does the configuration steps:
  Was: Disk, Net , Syncer
  Now: Disk, Syncer, Net
  
  In this order when the syncer wants to start (after connect) the
  right sync grop and rate is already set.
  

r1653 by phil on 2004-11-24 14:34:03 +0100 (Wed, 24 Nov 2004) 
  Changed paths:
     M /branches/drbd-0.7/ChangeLog
     M /branches/drbd-0.7/drbd.spec.in
     M /branches/drbd-0.7/user/drbdadm_main.c
  
  drbdadm looks at the minors of the specified devices for 
  determining the right minor_count for module loading.
  



Property changes on: trunk
___________________________________________________________________
Name: propagate:at
   - 1639
   + 1654

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2004-11-24 13:34:03 UTC (rev 1653)
+++ trunk/ChangeLog	2004-11-24 13:44:48 UTC (rev 1654)
@@ -19,6 +19,8 @@
  * Removal of warnings on 64bit architectures.
  * Backport of find_first_bit() for x86_64 aka AMD64 for use on 
    that architecture under Linux-2.4.x
+ * Changed the way drbdadm determines the minor_count parameter for
+   module loading.
  * Improvements to the drbddisk script, to do the right thing
    in case Heartbeat is configured with a small timeout than DRBD.
  * Lots of updates to the way Debian's DRBD packages works.

Modified: trunk/user/drbdadm_adjust.c
===================================================================
--- trunk/user/drbdadm_adjust.c	2004-11-24 13:34:03 UTC (rev 1653)
+++ trunk/user/drbdadm_adjust.c	2004-11-24 13:44:48 UTC (rev 1654)
@@ -340,8 +340,8 @@
     do_resize=0;
   }
   if(do_resize)  if( (rv=adm_resize(res,0)) ) return rv;
+  if(do_syncer)  if( (rv=adm_syncer(res,0)) ) return rv;
   if(do_connect) if( (rv=adm_connect(res,0))) return rv;
-  if(do_syncer)  if( (rv=adm_syncer(res,0)) ) return rv;
 
   return 0;
 }

Modified: trunk/user/drbdadm_main.c
===================================================================
--- trunk/user/drbdadm_main.c	2004-11-24 13:34:03 UTC (rev 1653)
+++ trunk/user/drbdadm_main.c	2004-11-24 13:44:48 UTC (rev 1654)
@@ -98,6 +98,7 @@
 char *config_file = NULL;
 struct d_resource* config = NULL;
 int nr_resources;
+int highest_minor;
 int config_valid=1;
 int dry_run;
 char* drbdsetup;
@@ -290,7 +291,7 @@
   int mc=global_options.minor_count;
 
   if(global_options.disable_io_hints) printf("disable_io_hints=1 ");
-  printf("minor_count=%d\n",mc ? mc : nr_resources);
+  printf("minor_count=%d\n",mc ? mc : (highest_minor+1) );
   return 0;
 }
 
@@ -610,8 +611,8 @@
 {
   int r;
   if( (r=adm_attach(res,unused)) ) return r;
-  if( (r=adm_connect(res,unused)) ) return r;
-  return adm_syncer(res,unused);
+  if( (r=adm_syncer(res,unused)) ) return r;
+  return adm_connect(res,unused);
 }
 
 static int on_primary(struct d_resource* res ,char* flag)
@@ -652,23 +653,27 @@
   return rv;
 }
 
+int minor_of_res(struct d_resource *res)
+{
+  struct stat sb;
+
+  if(stat(res->me->device,&sb)) {
+    perror("stat");
+  }
+
+  return minor(sb.st_rdev);
+}
+
 struct d_resource* res_by_minor(const char *id)
 {
   struct d_resource *res,*t;
-  struct stat sb;
   int mm;
-
   if(strncmp(id,"minor-",6)) return NULL;
   
   mm = m_strtoll(id+6,1);
 
   for_each_resource(res,t,config) {
-    if(stat(res->me->device,&sb)) {
-      perror("stat");
-    }
-    if( mm == minor(sb.st_rdev)) {
-      return res;
-    }
+    if( mm == minor_of_res(res)) return res;
   }
   return NULL;
 }
@@ -1205,11 +1210,16 @@
   {
     int mc=global_options.minor_count;
 
-    for_each_resource(res,tmp,config) nr_resources++;
+    highest_minor=0;
+    for_each_resource(res,tmp,config) {
+      int m = minor_of_res(res);
+      if ( m > highest_minor ) highest_minor = m;
+      nr_resources++;
+    }
 
-    if( mc && mc<nr_resources ) {
-      fprintf(stderr,"You have %d resources but a minor_count of %d in your"
-	      " config!\n",nr_resources,mc);
+    if( mc && mc<(highest_minor+1) ) {
+      fprintf(stderr,"The highest minor you have in your config is %d"
+	      "but a minor_count of %d in your config!\n", highest_minor,mc);
       exit(E_usage);
     }
   }



More information about the drbd-cvs mailing list