[DRBD-cvs] r1791 - in trunk: . documentation drbd drbd/linux user
www-data
www-data at garcon.linbit.com
Tue May 10 20:22:15 CEST 2005
Author: phil
Date: 2005-05-10 20:22:13 +0200 (Tue, 10 May 2005)
New Revision: 1791
Modified:
trunk/ROADMAP
trunk/documentation/drbdsetup.sgml
trunk/drbd/drbd_fs.c
trunk/drbd/drbd_int.h
trunk/drbd/drbd_receiver.c
trunk/drbd/linux/drbd.h
trunk/user/drbdadm_main.c
trunk/user/drbdsetup.c
Log:
* Removed the --human and --timeout-expired options to the primary
command.
* Removed the on_primary helper command.
This crap is no longer needed with the UUID based data generation
scheme.
Modified: trunk/ROADMAP
===================================================================
--- trunk/ROADMAP 2005-05-09 21:36:44 UTC (rev 1790)
+++ trunk/ROADMAP 2005-05-10 18:22:13 UTC (rev 1791)
@@ -406,11 +406,6 @@
As well as the currently known flags:
Consistent, WasUpToDate, LastState, ConnectedInd, WantFullSync
- The difference here is that the former flags are determined
- when the current-UUID is created, while the latter are modified
- as the state changes. When drbdmeta initializes the meta-data
- block it sets the current-UUID to JustCreated (a 64 bit constant ).
-
When the cluster is in Connected state, then the bitmpat gen-UUID
is set to 0 (Since the Bitmap is empty). When we create a new current
gen-UUID while we are disconencted the (old) current gets backed-up
Modified: trunk/documentation/drbdsetup.sgml
===================================================================
--- trunk/documentation/drbdsetup.sgml 2005-05-09 21:36:44 UTC (rev 1790)
+++ trunk/documentation/drbdsetup.sgml 2005-05-10 18:22:13 UTC (rev 1791)
@@ -406,29 +406,6 @@
</para>
<variablelist>
<varlistentry>
- <term><option>-h</option>,
- <option>--human</option></term>
- <listitem>
- <para>
- Indicates that this state change was issued by an
- administrator and has at cluster restart time precedence over
- decisions made by other parties.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><option>-t</option>,
- <option>--timeout-expired</option></term>
- <listitem>
- <para>
- Indicates that this state change was caused because a node did
- not showed up on cluster startup (The cluster started in
- degraded mode). At cluster restart this has precedence over
- decisions made by the cluster manager.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
<term><option>-d</option>,
<option>--do-what-I-say</option></term>
<listitem>
@@ -455,22 +432,6 @@
</para>
</refsect2>
<refsect2>
- <title>on_primary</title>
- <para>
- This sets additional flags for the next
- transition into primary state. The flags are only preserved as long
- as the <replaceable>device</replaceable> can not connect to its peer.
- The possible flags are <option>--inc-human</option> and
- <option>--inc-timeout-expired</option>.
- </para>
- <para>
- This is a conevenience command. It has the same effect as passing
- this options to the following <option>primary</option> command
- directly. See the <option>primary</option> command for a detailed
- description of the two flags.
- </para>
- </refsect2>
- <refsect2>
<title>invalidate</title>
<para>
This forces the local device of a pair of connected DRBD devices
Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c 2005-05-09 21:36:44 UTC (rev 1790)
+++ trunk/drbd/drbd_fs.c 2005-05-10 18:22:13 UTC (rev 1791)
@@ -738,7 +738,7 @@
D_ASSERT(semaphore_is_locked(&mdev->device_mutex));
- if ( (newstate & 0x3) == mdev->state.s.role ) return 0; /* nothing to do */
+ if ( (newstate & role_mask) == mdev->state.s.role ) return 0; /* nothing to do */
// exactly one of sec or pri. not both.
if ( !((newstate ^ (newstate >> 1)) & 1) ) return -EINVAL;
@@ -758,7 +758,7 @@
spin_lock_irq(&mdev->req_lock);
os = mdev->state;
- r = _drbd_set_state(mdev, _NS(role,newstate & 0x3), 0);
+ r = _drbd_set_state(mdev, _NS(role,newstate & role_mask), 0);
ns = mdev->state;
spin_unlock_irq(&mdev->req_lock);
after_state_ch(mdev,os,ns);
@@ -774,7 +774,7 @@
/* --do-what-I-say*/
if (mdev->state.s.disk < UpToDate) {
WARN("Forcefully set to UpToDate!\n");
- r = drbd_request_state(mdev,NS2(role,newstate & 0x3,
+ r = drbd_request_state(mdev,NS2(role,newstate & role_mask,
disk,UpToDate));
if(r<=0) return -EIO;
@@ -783,20 +783,11 @@
}
if ( r == -7 ) {
drbd_disks_t nps = drbd_try_outdate_peer(mdev);
- r = drbd_request_state(mdev,NS2(role,newstate & 0x3,pdsk,nps));
+ r = drbd_request_state(mdev,NS2(role,newstate & role_mask,pdsk,nps));
} else if ( r <= 0 ) print_st_err(mdev,os,ns,r);
if ( r <= 0 ) return -EACCES;
- if (mdev->state.s.conn >= Connected) {
- /* do NOT increase the Human count if we are connected,
- * and there is no reason for it. See
- * drbd_lk9.pdf middle of Page 7
- */
- newstate &= ~(Human|DontBlameDrbd);
- }
-
-
drbd_sync_me(mdev);
/* Wait until nothing is on the fly :) */
@@ -825,16 +816,6 @@
bd_release(mdev->this_bdev);
mdev->this_bdev->bd_disk = mdev->vdisk;
- if(test_bit(ON_PRI_INC_HUMAN,&mdev->flags)) {
- newstate |= Human;
- clear_bit(ON_PRI_INC_HUMAN,&mdev->flags);
- }
-
- if(test_bit(ON_PRI_INC_TIMEOUTEX,&mdev->flags)) {
- newstate |= TimeoutExpired;
- clear_bit(ON_PRI_INC_TIMEOUTEX,&mdev->flags);
- }
-
if ( (mdev->state.s.conn < WFReportParams &&
mdev->uuid[Bitmap] == 0) || forced ) {
drbd_uuid_new_current(mdev);
@@ -1074,28 +1055,13 @@
break;
case DRBD_IOCTL_SET_STATE:
- if (arg & ~(Primary|Secondary|Human|TimeoutExpired|
- DontBlameDrbd) ) {
+ if (arg & ~(Primary|Secondary|DontBlameDrbd) ) {
err = -EINVAL;
} else {
err = drbd_set_role(mdev,arg);
}
break;
- case DRBD_IOCTL_SET_STATE_FLAGS:
- if (arg & ~(Human|TimeoutExpired) ) {
- err = -EINVAL;
- } else {
- clear_bit(ON_PRI_INC_HUMAN,&mdev->flags);
- clear_bit(ON_PRI_INC_TIMEOUTEX,&mdev->flags);
-
- if (arg & Human )
- set_bit(ON_PRI_INC_HUMAN,&mdev->flags);
- if (arg & TimeoutExpired )
- set_bit(ON_PRI_INC_TIMEOUTEX,&mdev->flags);
- }
- break;
-
case DRBD_IOCTL_SET_DISK_CONFIG:
err = drbd_ioctl_set_disk(mdev,(struct ioctl_disk_config*)arg);
break;
Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h 2005-05-09 21:36:44 UTC (rev 1790)
+++ trunk/drbd/drbd_int.h 2005-05-10 18:22:13 UTC (rev 1791)
@@ -617,8 +617,6 @@
SEND_PING, // whether asender should send a ping asap
WRITER_PRESENT, // somebody opened us with write intent
STOP_SYNC_TIMER, // tell timer to cancel itself
- ON_PRI_INC_HUMAN, // When we become primary increase human-count
- ON_PRI_INC_TIMEOUTEX, // When " - " increase timeout-count
UNPLUG_QUEUED, // only relevant with kernel 2.4
UNPLUG_REMOTE, // whether sending a "UnplugRemote" makes sense
PROCESS_EE_RUNNING, // eek!
Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c 2005-05-09 21:36:44 UTC (rev 1790)
+++ trunk/drbd/drbd_receiver.c 2005-05-10 18:22:13 UTC (rev 1791)
@@ -703,9 +703,6 @@
}
}
- clear_bit(ON_PRI_INC_HUMAN,&mdev->flags);
- clear_bit(ON_PRI_INC_TIMEOUTEX,&mdev->flags);
-
sock->sk->sk_sndtimeo = mdev->conf.timeout*HZ/20;
sock->sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT;
Modified: trunk/drbd/linux/drbd.h
===================================================================
--- trunk/drbd/linux/drbd.h 2005-05-09 21:36:44 UTC (rev 1790)
+++ trunk/drbd/linux/drbd.h 2005-05-10 18:22:13 UTC (rev 1791)
@@ -175,9 +175,7 @@
Primary=1, // role
Secondary=2, // role
role_mask=3,
- Human=4, // flag for set_state
- TimeoutExpired=8, // flag for set_state
- DontBlameDrbd=16 // flag for set_state
+ DontBlameDrbd=4 // flag for set_state
} drbd_role_t;
/* The order of these constants is important.
Modified: trunk/user/drbdadm_main.c
===================================================================
--- trunk/user/drbdadm_main.c 2005-05-09 21:36:44 UTC (rev 1790)
+++ trunk/user/drbdadm_main.c 2005-05-10 18:22:13 UTC (rev 1791)
@@ -740,22 +740,6 @@
return 0;
}
-static int on_primary(struct d_resource* res ,char* flag)
-{
- char* argv[20];
- int argc=0;
-
- argc=0;
- argv[argc++]=drbdsetup;
- argv[argc++]=res->me->device;
- argv[argc++]="on_primary";
- argv[argc++]=flag;
- argv[argc++]=0;
-
- return m_system(argv,SLEEPS_SHORT);
-}
-
-
static int adm_wait_c(struct d_resource* res ,const char* unused)
{
char* argv[20];
@@ -771,10 +755,6 @@
rv = m_system(argv,SLEEPS_FOREVER);
- if(rv == 5) { // Timer expired
- rv = on_primary(res,"--inc-timeout-expired");
- }
-
return rv;
}
@@ -900,14 +880,9 @@
int i=0,rv=0;
for_each_resource(res,t,config) {
- if (pids[i] == -5) {
- rv |= on_primary(res,"--inc-timeout-expired");
+ if (pids[i] == -5 || pids[i] == -1000) {
pids[i]=0;
}
- if (pids[i] == -1000) {
- rv |= on_primary(res,"--inc-human");
- pids[i]=0;
- }
if (pids[i] == -20) rv = 20;
i++;
}
Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c 2005-05-09 21:36:44 UTC (rev 1790)
+++ trunk/user/drbdsetup.c 2005-05-10 18:22:13 UTC (rev 1791)
@@ -98,7 +98,6 @@
int cmd_primary(int drbd_fd,char** argv,int argc,struct option *options);
int cmd_secondary(int drbd_fd,char** argv,int argc,struct option *options);
-int cmd_on_primary(int drbd_fd,char** argv,int argc,struct option *options);
int cmd_wait_sync(int drbd_fd,char** argv,int argc,struct option *options);
int cmd_wait_connect(int drbd_fd,char** argv,int argc,struct option *options);
int cmd_invalidate(int drbd_fd,char** argv,int argc,struct option *options);
@@ -120,16 +119,9 @@
struct drbd_cmd commands[] = {
{"primary", cmd_primary, 0,
(struct option[]) {
- { "human", no_argument, 0, 'h' },
{ "do-what-I-say",no_argument, 0, 'd' },
- { "timeout-expired",no_argument, 0, 't' },
{ 0, 0, 0, 0 } } },
{"secondary", cmd_secondary, 0, 0, },
- {"on_primary", cmd_on_primary, 0,
- (struct option[]) {
- { "inc-human", no_argument, 0, 'h' },
- { "inc-timeout-expired",no_argument,0, 't' },
- { 0, 0, 0, 0 } } },
{"wait_sync", cmd_wait_sync, 0,
(struct option[]) {
{ "wfc-timeout",required_argument, 0, 't' },
@@ -745,20 +737,11 @@
int c;
PRINT_ARGV;
- /* only --timeout-expired may be abbreviated to -t
- * --human and --do-what-I-say have to be spelled out */
+ /* --do-what-I-say have to be spelled out */
c = getopt_long_only(argc,argv,make_optstring(options,'-'),options,0);
if(c == -1) break;
switch(c)
{
- case 'h':
- if (strcmp("--human",argv[optind-1])) {
- fprintf(stderr,"%s\nYou have to spell out --human, if you mean it\n",
- argv[optind-1]);
- return 20;
- }
- newstate |= Human;
- break;
case 'd':
if (strcmp("--do-what-I-say",argv[optind-1])) {
fprintf(stderr,"%s\nYou have to spell out --do-what-I-say, if you mean it\n",
@@ -767,9 +750,6 @@
}
newstate |= DontBlameDrbd;
break;
- case 't':
- newstate |= TimeoutExpired;
- break;
case 1: // non option argument. see getopt_long(3)
fprintf(stderr,"%s: Unexpected nonoption argument '%s'\n",cmdname,optarg);
case '?':
@@ -786,48 +766,6 @@
return set_state(drbd_fd,Secondary);
}
-int cmd_on_primary(int drbd_fd,char** argv,int argc,struct option *options)
-{
- int err;
- drbd_role_t flags=0;
-
- if(argc > 0)
- {
- while(1)
- {
- int c;
-
- PRINT_ARGV;
-
- c = getopt_long(argc,argv,make_optstring(options,'-'),options,0);
- if(c == -1) break;
- switch(c)
- {
- case 'h':
- flags |= Human;
- break;
- case 't':
- flags |= TimeoutExpired;
- break;
- case 1: // non option argument. see getopt_long(3)
- fprintf(stderr,"%s: Unexpected nonoption argument '%s'\n",cmdname,optarg);
- case '?':
- return 20;
- }
- }
- }
-
- err=ioctl(drbd_fd,DRBD_IOCTL_SET_STATE_FLAGS,flags);
- if(err)
- {
- PERROR("ioctl(,SET_STATE_FLAGS,) failed");
- exit(20);
- }
-
- return 0;
-}
-
-
int wait_on(int drbd_fd,char** argv,int argc,int wfct,int dwfct, int req,
struct option *options)
{
More information about the drbd-cvs
mailing list