[DRBD-cvs] svn commit by phil - r2652 - in trunk: drbd testing - *
Removed the SYNC_STARTED bit and replaced it with an
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Tue Jan 2 21:07:31 CET 2007
Author: phil
Date: 2007-01-02 21:07:10 +0100 (Tue, 02 Jan 2007)
New Revision: 2652
Removed:
trunk/testing/ioctl_structs_sizes.c
Modified:
trunk/drbd/drbd_int.h
trunk/drbd/drbd_main.c
trunk/drbd/drbd_receiver.c
trunk/drbd/drbd_req.c
trunk/drbd/drbd_req.h
Log:
* Removed the SYNC_STARTED bit and replaced it with an improved
concept.
Now there is a new command for ACK packets (RSWriteAck), this
tells the peer that it should call drbd_set_in_sync() for this
write. This is necessary to reliabely start a resync process
in a dual-primary setup.
Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h 2007-01-02 20:03:21 UTC (rev 2651)
+++ trunk/drbd/drbd_int.h 2007-01-02 20:07:10 UTC (rev 2652)
@@ -288,6 +288,7 @@
PingAck,
RecvAck, // Used in protocol B
WriteAck, // Used in protocol C
+ RSWriteAck, // Is a WriteAck, additionally call set_in_sync().
DiscardAck, // Used in protocol C, two-primaries conflict detection
NegAck, // Sent if local disk is unusable
NegDReply, // Local disk is broken...
@@ -336,6 +337,7 @@
[PingAck] = "PingAck",
[RecvAck] = "RecvAck",
[WriteAck] = "WriteAck",
+ [RSWriteAck] = "RSWriteAck",
[DiscardAck] = "DiscardAck",
[NegAck] = "NegAck",
[NegDReply] = "NegDReply",
@@ -679,7 +681,6 @@
UNPLUG_QUEUED, // only relevant with kernel 2.4
UNPLUG_REMOTE, // whether sending a "UnplugRemote" makes sense
MD_DIRTY, // current gen counts and flags not yet on disk
- SYNC_STARTED, // Needed to agree on the exact point in time..
DISCARD_CONCURRENT, // Set on one node, cleared on the peer!
USE_DEGR_WFC_T, // Use degr-wfc-timeout instead of wfc-timeout.
CLUSTER_ST_CHANGE, // Cluster wide state change going on...
Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c 2007-01-02 20:03:21 UTC (rev 2651)
+++ trunk/drbd/drbd_main.c 2007-01-02 20:07:10 UTC (rev 2652)
@@ -764,7 +764,6 @@
/** post-state-change actions **/
if ( os.conn >= SyncSource && ns.conn <= Connected ) {
- clear_bit(SYNC_STARTED,&mdev->flags);
set_bit(STOP_SYNC_TIMER,&mdev->flags);
mod_timer(&mdev->resync_timer,jiffies);
}
Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c 2007-01-02 20:03:21 UTC (rev 2651)
+++ trunk/drbd/drbd_receiver.c 2007-01-02 20:07:10 UTC (rev 2652)
@@ -1024,8 +1024,7 @@
if (likely( drbd_bio_uptodate(e->private_bio) )) {
drbd_set_in_sync(mdev, sector, e->size);
- ok = drbd_send_ack(mdev,WriteAck,e);
- set_bit(SYNC_STARTED,&mdev->flags);
+ ok = drbd_send_ack(mdev,RSWriteAck,e);
} else {
// Record failure to sync
drbd_rs_failed_io(mdev, sector, e->size);
@@ -1170,12 +1169,15 @@
struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
sector_t sector = e->sector;
// unsigned int epoch_size;
- int ok=1;
+ int ok=1,pcmd;
if(mdev->net_conf->wire_protocol == DRBD_PROT_C) {
if(likely(drbd_bio_uptodate(e->private_bio))) {
- ok &= drbd_send_ack(mdev,WriteAck,e);
- if (test_bit(SYNC_STARTED,&mdev->flags))
+ pcmd = (mdev->state.conn >= SyncSource &&
+ mdev->state.conn <= PausedSyncT) ?
+ RSWriteAck : WriteAck;
+ ok &= drbd_send_ack(mdev,pcmd,e);
+ if(pcmd==RSWriteAck)
drbd_set_in_sync(mdev,sector,e->size);
} else {
/* FIXME I think we should send a NegAck regardless of
@@ -3092,7 +3094,6 @@
if( is_syncer_block_id(p->block_id)) {
drbd_set_in_sync(mdev,sector,blksize);
- set_bit(SYNC_STARTED,&mdev->flags);
dec_rs_pending(mdev);
} else {
spin_lock_irq(&mdev->req_lock);
@@ -3105,6 +3106,10 @@
}
switch (be16_to_cpu(h->command)) {
+ case RSWriteAck:
+ D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_C);
+ _req_mod(req,write_acked_by_peer_and_sis,0);
+ break;
case WriteAck:
D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_C);
_req_mod(req,write_acked_by_peer,0);
@@ -3242,6 +3247,7 @@
[PingAck] ={ sizeof(Drbd_Header), got_PingAck },
[RecvAck] ={ sizeof(Drbd_BlockAck_Packet), got_BlockAck },
[WriteAck] ={ sizeof(Drbd_BlockAck_Packet), got_BlockAck },
+ [RSWriteAck]={ sizeof(Drbd_BlockAck_Packet), got_BlockAck },
[DiscardAck]={ sizeof(Drbd_BlockAck_Packet), got_BlockAck },
[NegAck] ={ sizeof(Drbd_BlockAck_Packet), got_NegAck },
[NegDReply] ={ sizeof(Drbd_BlockAck_Packet), got_NegDReply },
Modified: trunk/drbd/drbd_req.c
===================================================================
--- trunk/drbd/drbd_req.c 2007-01-02 20:03:21 UTC (rev 2651)
+++ trunk/drbd/drbd_req.c 2007-01-02 20:07:10 UTC (rev 2652)
@@ -242,7 +242,7 @@
}
if( (s & RQ_NET_OK) && (s & RQ_LOCAL_OK) &&
- test_bit(SYNC_STARTED,&mdev->flags) ) {
+ (s & RQ_NET_SIS) ) {
drbd_set_in_sync(mdev,req->sector,req->size);
}
@@ -614,6 +614,8 @@
_req_may_be_done(req,error);
break;
+ case write_acked_by_peer_and_sis:
+ req->rq_state |= RQ_NET_SIS;
case conflict_discarded_by_peer:
/* interesstingly, this is the same thing! */
case write_acked_by_peer:
Modified: trunk/drbd/drbd_req.h
===================================================================
--- trunk/drbd/drbd_req.h 2007-01-02 20:03:21 UTC (rev 2651)
+++ trunk/drbd/drbd_req.h 2007-01-02 20:07:10 UTC (rev 2652)
@@ -100,6 +100,7 @@
connection_lost_while_pending,
recv_acked_by_peer,
write_acked_by_peer,
+ write_acked_by_peer_and_sis, // and set_in_sync
conflict_discarded_by_peer,
neg_acked,
barrier_acked, /* in protocol A and B */
@@ -175,6 +176,9 @@
* was successfully written on the peer.
*/
__RQ_NET_OK,
+
+ /* peer called drbd_set_in_sync() for this write */
+ __RQ_NET_SIS,
};
#define RQ_LOCAL_PENDING (1UL << __RQ_LOCAL_PENDING)
@@ -188,6 +192,7 @@
#define RQ_NET_SENT (1UL << __RQ_NET_SENT)
#define RQ_NET_DONE (1UL << __RQ_NET_DONE)
#define RQ_NET_OK (1UL << __RQ_NET_OK)
+#define RQ_NET_SIS (1UL << __RQ_NET_SIS)
#define RQ_NET_MASK (((RQ_NET_OK << 1)-1) & ~RQ_LOCAL_MASK) /* 0xf8 */
Deleted: trunk/testing/ioctl_structs_sizes.c
===================================================================
--- trunk/testing/ioctl_structs_sizes.c 2007-01-02 20:03:21 UTC (rev 2651)
+++ trunk/testing/ioctl_structs_sizes.c 2007-01-02 20:07:10 UTC (rev 2652)
@@ -1,29 +0,0 @@
-#include <stdio.h>
-#include <linux/drbd.h>
-
-#define SZO(x) \
-({ int _i = sizeof(x); printf("sizeof(" #x ") = %d\n", _i); \
- if( _i % 8 ) printf(" WARN sizeof(" #x ") %% 8 != 0\n"); _i; })
-
-#define DRBD_08_SUM 1696
-
-int main()
-{
- int sum=0;
-
- sum += SZO(struct disk_config);
- sum += SZO(struct net_config);
- sum += SZO(struct syncer_config);
- sum += SZO(struct ioctl_disk_config);
- sum += SZO(struct ioctl_net_config);
- sum += SZO(struct ioctl_syncer_config);
- sum += SZO(struct ioctl_wait);
- sum += SZO(struct ioctl_get_config);
- sum += SZO(struct ioctl_get_uuids);
-
- printf("sum = %d DRBD_08_SUM = %d\n",sum,DRBD_08_SUM);
-
- printf(sum == DRBD_08_SUM ? "OKAY\n" : "FAILED\n" );
-
- return sum != DRBD_08_SUM; /* if not equal, exit code is non-zero */
-}
More information about the drbd-cvs
mailing list