diff options
author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2012-08-01 06:33:51 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-09 08:05:49 -0500 |
commit | d4dabbe22d38752674c582e5bb40716a72397355 (patch) | |
tree | 51a89e48ba52a80fa93b3c37390e5b772a2b7bb8 /drivers/block/drbd | |
parent | 232fd3f4a01f45d5402c2e03f7c8815d80bec25b (diff) |
drbd: disambiguation, s/P_DISCARD_WRITE/P_SUPERSEDED/
To avoid confusion with REQ_DISCARD aka TRIM, rename our
"discard concurrent write acks" from P_DISCARD_WRITE to P_SUPERSEDED.
At the same time, rename the drbd request event DISCARD_WRITE
to CONFLICT_RESOLVED. It already triggers both successful completion
or restart of the request, depending on our RQ_POSTPONED flag.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd')
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 4 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 2 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 33 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_req.c | 6 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_req.h | 2 |
5 files changed, 24 insertions, 23 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index e5c98533c90c..91b73247f65d 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -197,7 +197,7 @@ enum drbd_packet { | |||
197 | P_RECV_ACK = 0x15, /* Used in protocol B */ | 197 | P_RECV_ACK = 0x15, /* Used in protocol B */ |
198 | P_WRITE_ACK = 0x16, /* Used in protocol C */ | 198 | P_WRITE_ACK = 0x16, /* Used in protocol C */ |
199 | P_RS_WRITE_ACK = 0x17, /* Is a P_WRITE_ACK, additionally call set_in_sync(). */ | 199 | P_RS_WRITE_ACK = 0x17, /* Is a P_WRITE_ACK, additionally call set_in_sync(). */ |
200 | P_DISCARD_WRITE = 0x18, /* Used in proto C, two-primaries conflict detection */ | 200 | P_SUPERSEDED = 0x18, /* Used in proto C, two-primaries conflict detection */ |
201 | P_NEG_ACK = 0x19, /* Sent if local disk is unusable */ | 201 | P_NEG_ACK = 0x19, /* Sent if local disk is unusable */ |
202 | P_NEG_DREPLY = 0x1a, /* Local disk is broken... */ | 202 | P_NEG_DREPLY = 0x1a, /* Local disk is broken... */ |
203 | P_NEG_RS_DREPLY = 0x1b, /* Local disk is broken... */ | 203 | P_NEG_RS_DREPLY = 0x1b, /* Local disk is broken... */ |
@@ -335,7 +335,7 @@ struct p_data { | |||
335 | * commands which share a struct: | 335 | * commands which share a struct: |
336 | * p_block_ack: | 336 | * p_block_ack: |
337 | * P_RECV_ACK (proto B), P_WRITE_ACK (proto C), | 337 | * P_RECV_ACK (proto B), P_WRITE_ACK (proto C), |
338 | * P_DISCARD_WRITE (proto C, two-primaries conflict detection) | 338 | * P_SUPERSEDED (proto C, two-primaries conflict detection) |
339 | * p_block_req: | 339 | * p_block_req: |
340 | * P_DATA_REQUEST, P_RS_DATA_REQUEST | 340 | * P_DATA_REQUEST, P_RS_DATA_REQUEST |
341 | */ | 341 | */ |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 85d95ec405ef..328ce80fecfa 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -3339,7 +3339,7 @@ const char *cmdname(enum drbd_packet cmd) | |||
3339 | [P_RECV_ACK] = "RecvAck", | 3339 | [P_RECV_ACK] = "RecvAck", |
3340 | [P_WRITE_ACK] = "WriteAck", | 3340 | [P_WRITE_ACK] = "WriteAck", |
3341 | [P_RS_WRITE_ACK] = "RSWriteAck", | 3341 | [P_RS_WRITE_ACK] = "RSWriteAck", |
3342 | [P_DISCARD_WRITE] = "DiscardWrite", | 3342 | [P_SUPERSEDED] = "Superseded", |
3343 | [P_NEG_ACK] = "NegAck", | 3343 | [P_NEG_ACK] = "NegAck", |
3344 | [P_NEG_DREPLY] = "NegDReply", | 3344 | [P_NEG_DREPLY] = "NegDReply", |
3345 | [P_NEG_RS_DREPLY] = "NegRSDReply", | 3345 | [P_NEG_RS_DREPLY] = "NegRSDReply", |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index d507700df85c..afab66bbc31f 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -425,7 +425,7 @@ static int drbd_finish_peer_reqs(struct drbd_conf *mdev) | |||
425 | drbd_free_net_peer_req(mdev, peer_req); | 425 | drbd_free_net_peer_req(mdev, peer_req); |
426 | 426 | ||
427 | /* possible callbacks here: | 427 | /* possible callbacks here: |
428 | * e_end_block, and e_end_resync_block, e_send_discard_write. | 428 | * e_end_block, and e_end_resync_block, e_send_superseded. |
429 | * all ignore the last argument. | 429 | * all ignore the last argument. |
430 | */ | 430 | */ |
431 | list_for_each_entry_safe(peer_req, t, &work_list, w.list) { | 431 | list_for_each_entry_safe(peer_req, t, &work_list, w.list) { |
@@ -1803,7 +1803,7 @@ static void restart_conflicting_writes(struct drbd_conf *mdev, | |||
1803 | continue; | 1803 | continue; |
1804 | /* as it is RQ_POSTPONED, this will cause it to | 1804 | /* as it is RQ_POSTPONED, this will cause it to |
1805 | * be queued on the retry workqueue. */ | 1805 | * be queued on the retry workqueue. */ |
1806 | __req_mod(req, DISCARD_WRITE, NULL); | 1806 | __req_mod(req, CONFLICT_RESOLVED, NULL); |
1807 | } | 1807 | } |
1808 | } | 1808 | } |
1809 | 1809 | ||
@@ -1864,9 +1864,9 @@ static int e_send_ack(struct drbd_work *w, enum drbd_packet ack) | |||
1864 | return err; | 1864 | return err; |
1865 | } | 1865 | } |
1866 | 1866 | ||
1867 | static int e_send_discard_write(struct drbd_work *w, int unused) | 1867 | static int e_send_superseded(struct drbd_work *w, int unused) |
1868 | { | 1868 | { |
1869 | return e_send_ack(w, P_DISCARD_WRITE); | 1869 | return e_send_ack(w, P_SUPERSEDED); |
1870 | } | 1870 | } |
1871 | 1871 | ||
1872 | static int e_send_retry_write(struct drbd_work *w, int unused) | 1872 | static int e_send_retry_write(struct drbd_work *w, int unused) |
@@ -1874,7 +1874,7 @@ static int e_send_retry_write(struct drbd_work *w, int unused) | |||
1874 | struct drbd_tconn *tconn = w->mdev->tconn; | 1874 | struct drbd_tconn *tconn = w->mdev->tconn; |
1875 | 1875 | ||
1876 | return e_send_ack(w, tconn->agreed_pro_version >= 100 ? | 1876 | return e_send_ack(w, tconn->agreed_pro_version >= 100 ? |
1877 | P_RETRY_WRITE : P_DISCARD_WRITE); | 1877 | P_RETRY_WRITE : P_SUPERSEDED); |
1878 | } | 1878 | } |
1879 | 1879 | ||
1880 | static bool seq_greater(u32 a, u32 b) | 1880 | static bool seq_greater(u32 a, u32 b) |
@@ -2082,11 +2082,11 @@ static int handle_write_conflicts(struct drbd_conf *mdev, | |||
2082 | if (resolve_conflicts) { | 2082 | if (resolve_conflicts) { |
2083 | /* | 2083 | /* |
2084 | * If the peer request is fully contained within the | 2084 | * If the peer request is fully contained within the |
2085 | * overlapping request, it can be discarded; otherwise, | 2085 | * overlapping request, it can be considered overwritten |
2086 | * it will be retried once all overlapping requests | 2086 | * and thus superseded; otherwise, it will be retried |
2087 | * have completed. | 2087 | * once all overlapping requests have completed. |
2088 | */ | 2088 | */ |
2089 | bool discard = i->sector <= sector && i->sector + | 2089 | bool superseded = i->sector <= sector && i->sector + |
2090 | (i->size >> 9) >= sector + (size >> 9); | 2090 | (i->size >> 9) >= sector + (size >> 9); |
2091 | 2091 | ||
2092 | if (!equal) | 2092 | if (!equal) |
@@ -2095,10 +2095,10 @@ static int handle_write_conflicts(struct drbd_conf *mdev, | |||
2095 | "assuming %s came first\n", | 2095 | "assuming %s came first\n", |
2096 | (unsigned long long)i->sector, i->size, | 2096 | (unsigned long long)i->sector, i->size, |
2097 | (unsigned long long)sector, size, | 2097 | (unsigned long long)sector, size, |
2098 | discard ? "local" : "remote"); | 2098 | superseded ? "local" : "remote"); |
2099 | 2099 | ||
2100 | inc_unacked(mdev); | 2100 | inc_unacked(mdev); |
2101 | peer_req->w.cb = discard ? e_send_discard_write : | 2101 | peer_req->w.cb = superseded ? e_send_superseded : |
2102 | e_send_retry_write; | 2102 | e_send_retry_write; |
2103 | list_add_tail(&peer_req->w.list, &mdev->done_ee); | 2103 | list_add_tail(&peer_req->w.list, &mdev->done_ee); |
2104 | wake_asender(mdev->tconn); | 2104 | wake_asender(mdev->tconn); |
@@ -2119,8 +2119,9 @@ static int handle_write_conflicts(struct drbd_conf *mdev, | |||
2119 | !(req->rq_state & RQ_POSTPONED)) { | 2119 | !(req->rq_state & RQ_POSTPONED)) { |
2120 | /* | 2120 | /* |
2121 | * Wait for the node with the discard flag to | 2121 | * Wait for the node with the discard flag to |
2122 | * decide if this request will be discarded or | 2122 | * decide if this request has been superseded |
2123 | * retried. Requests that are discarded will | 2123 | * or needs to be retried. |
2124 | * Requests that have been superseded will | ||
2124 | * disappear from the write_requests tree. | 2125 | * disappear from the write_requests tree. |
2125 | * | 2126 | * |
2126 | * In addition, wait for the conflicting | 2127 | * In addition, wait for the conflicting |
@@ -4994,8 +4995,8 @@ static int got_BlockAck(struct drbd_tconn *tconn, struct packet_info *pi) | |||
4994 | case P_RECV_ACK: | 4995 | case P_RECV_ACK: |
4995 | what = RECV_ACKED_BY_PEER; | 4996 | what = RECV_ACKED_BY_PEER; |
4996 | break; | 4997 | break; |
4997 | case P_DISCARD_WRITE: | 4998 | case P_SUPERSEDED: |
4998 | what = DISCARD_WRITE; | 4999 | what = CONFLICT_RESOLVED; |
4999 | break; | 5000 | break; |
5000 | case P_RETRY_WRITE: | 5001 | case P_RETRY_WRITE: |
5001 | what = POSTPONE_WRITE; | 5002 | what = POSTPONE_WRITE; |
@@ -5220,7 +5221,7 @@ static struct asender_cmd asender_tbl[] = { | |||
5220 | [P_RECV_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, | 5221 | [P_RECV_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, |
5221 | [P_WRITE_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, | 5222 | [P_WRITE_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, |
5222 | [P_RS_WRITE_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, | 5223 | [P_RS_WRITE_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, |
5223 | [P_DISCARD_WRITE] = { sizeof(struct p_block_ack), got_BlockAck }, | 5224 | [P_SUPERSEDED] = { sizeof(struct p_block_ack), got_BlockAck }, |
5224 | [P_NEG_ACK] = { sizeof(struct p_block_ack), got_NegAck }, | 5225 | [P_NEG_ACK] = { sizeof(struct p_block_ack), got_NegAck }, |
5225 | [P_NEG_DREPLY] = { sizeof(struct p_block_ack), got_NegDReply }, | 5226 | [P_NEG_DREPLY] = { sizeof(struct p_block_ack), got_NegDReply }, |
5226 | [P_NEG_RS_DREPLY] = { sizeof(struct p_block_ack), got_NegRSDReply }, | 5227 | [P_NEG_RS_DREPLY] = { sizeof(struct p_block_ack), got_NegRSDReply }, |
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c index 67768570141a..266ef24b3c74 100644 --- a/drivers/block/drbd/drbd_req.c +++ b/drivers/block/drbd/drbd_req.c | |||
@@ -611,13 +611,13 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, | |||
611 | RQ_NET_DONE); | 611 | RQ_NET_DONE); |
612 | break; | 612 | break; |
613 | 613 | ||
614 | case DISCARD_WRITE: | 614 | case CONFLICT_RESOLVED: |
615 | /* for discarded conflicting writes of multiple primaries, | 615 | /* for superseded conflicting writes of multiple primaries, |
616 | * there is no need to keep anything in the tl, potential | 616 | * there is no need to keep anything in the tl, potential |
617 | * node crashes are covered by the activity log. | 617 | * node crashes are covered by the activity log. |
618 | * | 618 | * |
619 | * If this request had been marked as RQ_POSTPONED before, | 619 | * If this request had been marked as RQ_POSTPONED before, |
620 | * it will actually not be discarded, but "restarted", | 620 | * it will actually not be completed, but "restarted", |
621 | * resubmitted from the retry worker context. */ | 621 | * resubmitted from the retry worker context. */ |
622 | D_ASSERT(req->rq_state & RQ_NET_PENDING); | 622 | D_ASSERT(req->rq_state & RQ_NET_PENDING); |
623 | D_ASSERT(req->rq_state & RQ_EXP_WRITE_ACK); | 623 | D_ASSERT(req->rq_state & RQ_EXP_WRITE_ACK); |
diff --git a/drivers/block/drbd/drbd_req.h b/drivers/block/drbd/drbd_req.h index 9611713c3580..016de6b8bb57 100644 --- a/drivers/block/drbd/drbd_req.h +++ b/drivers/block/drbd/drbd_req.h | |||
@@ -97,7 +97,7 @@ enum drbd_req_event { | |||
97 | RECV_ACKED_BY_PEER, | 97 | RECV_ACKED_BY_PEER, |
98 | WRITE_ACKED_BY_PEER, | 98 | WRITE_ACKED_BY_PEER, |
99 | WRITE_ACKED_BY_PEER_AND_SIS, /* and set_in_sync */ | 99 | WRITE_ACKED_BY_PEER_AND_SIS, /* and set_in_sync */ |
100 | DISCARD_WRITE, | 100 | CONFLICT_RESOLVED, |
101 | POSTPONE_WRITE, | 101 | POSTPONE_WRITE, |
102 | NEG_ACKED, | 102 | NEG_ACKED, |
103 | BARRIER_ACKED, /* in protocol A and B */ | 103 | BARRIER_ACKED, /* in protocol A and B */ |