[DRBD-cvs] r1653 - in branches/drbd-0.7: . user
svn at svn.drbd.org
svn at svn.drbd.org
Wed Nov 24 14:34:04 CET 2004
Author: phil
Date: 2004-11-24 14:34:03 +0100 (Wed, 24 Nov 2004)
New Revision: 1653
Modified:
branches/drbd-0.7/ChangeLog
branches/drbd-0.7/drbd.spec.in
branches/drbd-0.7/user/drbdadm_main.c
Log:
drbdadm looks at the minors of the specified devices for
determining the right minor_count for module loading.
Modified: branches/drbd-0.7/ChangeLog
===================================================================
--- branches/drbd-0.7/ChangeLog 2004-11-23 22:47:50 UTC (rev 1652)
+++ branches/drbd-0.7/ChangeLog 2004-11-24 13:34:03 UTC (rev 1653)
@@ -19,6 +19,8 @@
* Backport of find_first_bit() for x86_64 aka AMD64 for use on
that architecture under Linux-2.4.x
* Changed drbdadm to do the syncer config before the net config.
+ * 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: branches/drbd-0.7/drbd.spec.in
===================================================================
--- branches/drbd-0.7/drbd.spec.in 2004-11-23 22:47:50 UTC (rev 1652)
+++ branches/drbd-0.7/drbd.spec.in 2004-11-24 13:34:03 UTC (rev 1653)
@@ -184,6 +184,8 @@
* Backport of find_first_bit() for x86_64 aka AMD64 for use on
that architecture under Linux-2.4.x
* Changed drbdadm to do the syncer config before the net config.
+ * 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: branches/drbd-0.7/user/drbdadm_main.c
===================================================================
--- branches/drbd-0.7/user/drbdadm_main.c 2004-11-23 22:47:50 UTC (rev 1652)
+++ branches/drbd-0.7/user/drbdadm_main.c 2004-11-24 13:34:03 UTC (rev 1653)
@@ -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;
@@ -283,7 +284,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;
}
@@ -616,7 +617,17 @@
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);
+}
+
/* In case a child exited, or exits, its return code is stored as
negative number in the pids[i] array */
static int childs_running(pid_t* pids,int opts)
@@ -1163,11 +1174,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