Commit d4dabbe2 authored by Lars Ellenberg's avatar Lars Ellenberg Committed by Philipp Reisner

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: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent 232fd3f4
...@@ -197,7 +197,7 @@ enum drbd_packet { ...@@ -197,7 +197,7 @@ enum drbd_packet {
P_RECV_ACK = 0x15, /* Used in protocol B */ P_RECV_ACK = 0x15, /* Used in protocol B */
P_WRITE_ACK = 0x16, /* Used in protocol C */ P_WRITE_ACK = 0x16, /* Used in protocol C */
P_RS_WRITE_ACK = 0x17, /* Is a P_WRITE_ACK, additionally call set_in_sync(). */ P_RS_WRITE_ACK = 0x17, /* Is a P_WRITE_ACK, additionally call set_in_sync(). */
P_DISCARD_WRITE = 0x18, /* Used in proto C, two-primaries conflict detection */ P_SUPERSEDED = 0x18, /* Used in proto C, two-primaries conflict detection */
P_NEG_ACK = 0x19, /* Sent if local disk is unusable */ P_NEG_ACK = 0x19, /* Sent if local disk is unusable */
P_NEG_DREPLY = 0x1a, /* Local disk is broken... */ P_NEG_DREPLY = 0x1a, /* Local disk is broken... */
P_NEG_RS_DREPLY = 0x1b, /* Local disk is broken... */ P_NEG_RS_DREPLY = 0x1b, /* Local disk is broken... */
...@@ -335,7 +335,7 @@ struct p_data { ...@@ -335,7 +335,7 @@ struct p_data {
* commands which share a struct: * commands which share a struct:
* p_block_ack: * p_block_ack:
* P_RECV_ACK (proto B), P_WRITE_ACK (proto C), * P_RECV_ACK (proto B), P_WRITE_ACK (proto C),
* P_DISCARD_WRITE (proto C, two-primaries conflict detection) * P_SUPERSEDED (proto C, two-primaries conflict detection)
* p_block_req: * p_block_req:
* P_DATA_REQUEST, P_RS_DATA_REQUEST * P_DATA_REQUEST, P_RS_DATA_REQUEST
*/ */
......
...@@ -3339,7 +3339,7 @@ const char *cmdname(enum drbd_packet cmd) ...@@ -3339,7 +3339,7 @@ const char *cmdname(enum drbd_packet cmd)
[P_RECV_ACK] = "RecvAck", [P_RECV_ACK] = "RecvAck",
[P_WRITE_ACK] = "WriteAck", [P_WRITE_ACK] = "WriteAck",
[P_RS_WRITE_ACK] = "RSWriteAck", [P_RS_WRITE_ACK] = "RSWriteAck",
[P_DISCARD_WRITE] = "DiscardWrite", [P_SUPERSEDED] = "Superseded",
[P_NEG_ACK] = "NegAck", [P_NEG_ACK] = "NegAck",
[P_NEG_DREPLY] = "NegDReply", [P_NEG_DREPLY] = "NegDReply",
[P_NEG_RS_DREPLY] = "NegRSDReply", [P_NEG_RS_DREPLY] = "NegRSDReply",
......
...@@ -425,7 +425,7 @@ static int drbd_finish_peer_reqs(struct drbd_conf *mdev) ...@@ -425,7 +425,7 @@ static int drbd_finish_peer_reqs(struct drbd_conf *mdev)
drbd_free_net_peer_req(mdev, peer_req); drbd_free_net_peer_req(mdev, peer_req);
/* possible callbacks here: /* possible callbacks here:
* e_end_block, and e_end_resync_block, e_send_discard_write. * e_end_block, and e_end_resync_block, e_send_superseded.
* all ignore the last argument. * all ignore the last argument.
*/ */
list_for_each_entry_safe(peer_req, t, &work_list, w.list) { 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,7 +1803,7 @@ static void restart_conflicting_writes(struct drbd_conf *mdev,
continue; continue;
/* as it is RQ_POSTPONED, this will cause it to /* as it is RQ_POSTPONED, this will cause it to
* be queued on the retry workqueue. */ * be queued on the retry workqueue. */
__req_mod(req, DISCARD_WRITE, NULL); __req_mod(req, CONFLICT_RESOLVED, NULL);
} }
} }
...@@ -1864,9 +1864,9 @@ static int e_send_ack(struct drbd_work *w, enum drbd_packet ack) ...@@ -1864,9 +1864,9 @@ static int e_send_ack(struct drbd_work *w, enum drbd_packet ack)
return err; return err;
} }
static int e_send_discard_write(struct drbd_work *w, int unused) static int e_send_superseded(struct drbd_work *w, int unused)
{ {
return e_send_ack(w, P_DISCARD_WRITE); return e_send_ack(w, P_SUPERSEDED);
} }
static int e_send_retry_write(struct drbd_work *w, int unused) 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,7 +1874,7 @@ static int e_send_retry_write(struct drbd_work *w, int unused)
struct drbd_tconn *tconn = w->mdev->tconn; struct drbd_tconn *tconn = w->mdev->tconn;
return e_send_ack(w, tconn->agreed_pro_version >= 100 ? return e_send_ack(w, tconn->agreed_pro_version >= 100 ?
P_RETRY_WRITE : P_DISCARD_WRITE); P_RETRY_WRITE : P_SUPERSEDED);
} }
static bool seq_greater(u32 a, u32 b) static bool seq_greater(u32 a, u32 b)
...@@ -2082,11 +2082,11 @@ static int handle_write_conflicts(struct drbd_conf *mdev, ...@@ -2082,11 +2082,11 @@ static int handle_write_conflicts(struct drbd_conf *mdev,
if (resolve_conflicts) { if (resolve_conflicts) {
/* /*
* If the peer request is fully contained within the * If the peer request is fully contained within the
* overlapping request, it can be discarded; otherwise, * overlapping request, it can be considered overwritten
* it will be retried once all overlapping requests * and thus superseded; otherwise, it will be retried
* have completed. * once all overlapping requests have completed.
*/ */
bool discard = i->sector <= sector && i->sector + bool superseded = i->sector <= sector && i->sector +
(i->size >> 9) >= sector + (size >> 9); (i->size >> 9) >= sector + (size >> 9);
if (!equal) if (!equal)
...@@ -2095,10 +2095,10 @@ static int handle_write_conflicts(struct drbd_conf *mdev, ...@@ -2095,10 +2095,10 @@ static int handle_write_conflicts(struct drbd_conf *mdev,
"assuming %s came first\n", "assuming %s came first\n",
(unsigned long long)i->sector, i->size, (unsigned long long)i->sector, i->size,
(unsigned long long)sector, size, (unsigned long long)sector, size,
discard ? "local" : "remote"); superseded ? "local" : "remote");
inc_unacked(mdev); inc_unacked(mdev);
peer_req->w.cb = discard ? e_send_discard_write : peer_req->w.cb = superseded ? e_send_superseded :
e_send_retry_write; e_send_retry_write;
list_add_tail(&peer_req->w.list, &mdev->done_ee); list_add_tail(&peer_req->w.list, &mdev->done_ee);
wake_asender(mdev->tconn); wake_asender(mdev->tconn);
...@@ -2119,8 +2119,9 @@ static int handle_write_conflicts(struct drbd_conf *mdev, ...@@ -2119,8 +2119,9 @@ static int handle_write_conflicts(struct drbd_conf *mdev,
!(req->rq_state & RQ_POSTPONED)) { !(req->rq_state & RQ_POSTPONED)) {
/* /*
* Wait for the node with the discard flag to * Wait for the node with the discard flag to
* decide if this request will be discarded or * decide if this request has been superseded
* retried. Requests that are discarded will * or needs to be retried.
* Requests that have been superseded will
* disappear from the write_requests tree. * disappear from the write_requests tree.
* *
* In addition, wait for the conflicting * In addition, wait for the conflicting
...@@ -4994,8 +4995,8 @@ static int got_BlockAck(struct drbd_tconn *tconn, struct packet_info *pi) ...@@ -4994,8 +4995,8 @@ static int got_BlockAck(struct drbd_tconn *tconn, struct packet_info *pi)
case P_RECV_ACK: case P_RECV_ACK:
what = RECV_ACKED_BY_PEER; what = RECV_ACKED_BY_PEER;
break; break;
case P_DISCARD_WRITE: case P_SUPERSEDED:
what = DISCARD_WRITE; what = CONFLICT_RESOLVED;
break; break;
case P_RETRY_WRITE: case P_RETRY_WRITE:
what = POSTPONE_WRITE; what = POSTPONE_WRITE;
...@@ -5220,7 +5221,7 @@ static struct asender_cmd asender_tbl[] = { ...@@ -5220,7 +5221,7 @@ static struct asender_cmd asender_tbl[] = {
[P_RECV_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, [P_RECV_ACK] = { sizeof(struct p_block_ack), got_BlockAck },
[P_WRITE_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, [P_WRITE_ACK] = { sizeof(struct p_block_ack), got_BlockAck },
[P_RS_WRITE_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, [P_RS_WRITE_ACK] = { sizeof(struct p_block_ack), got_BlockAck },
[P_DISCARD_WRITE] = { sizeof(struct p_block_ack), got_BlockAck }, [P_SUPERSEDED] = { sizeof(struct p_block_ack), got_BlockAck },
[P_NEG_ACK] = { sizeof(struct p_block_ack), got_NegAck }, [P_NEG_ACK] = { sizeof(struct p_block_ack), got_NegAck },
[P_NEG_DREPLY] = { sizeof(struct p_block_ack), got_NegDReply }, [P_NEG_DREPLY] = { sizeof(struct p_block_ack), got_NegDReply },
[P_NEG_RS_DREPLY] = { sizeof(struct p_block_ack), got_NegRSDReply }, [P_NEG_RS_DREPLY] = { sizeof(struct p_block_ack), got_NegRSDReply },
......
...@@ -611,13 +611,13 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, ...@@ -611,13 +611,13 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
RQ_NET_DONE); RQ_NET_DONE);
break; break;
case DISCARD_WRITE: case CONFLICT_RESOLVED:
/* for discarded conflicting writes of multiple primaries, /* for superseded conflicting writes of multiple primaries,
* there is no need to keep anything in the tl, potential * there is no need to keep anything in the tl, potential
* node crashes are covered by the activity log. * node crashes are covered by the activity log.
* *
* If this request had been marked as RQ_POSTPONED before, * If this request had been marked as RQ_POSTPONED before,
* it will actually not be discarded, but "restarted", * it will actually not be completed, but "restarted",
* resubmitted from the retry worker context. */ * resubmitted from the retry worker context. */
D_ASSERT(req->rq_state & RQ_NET_PENDING); D_ASSERT(req->rq_state & RQ_NET_PENDING);
D_ASSERT(req->rq_state & RQ_EXP_WRITE_ACK); D_ASSERT(req->rq_state & RQ_EXP_WRITE_ACK);
......
...@@ -97,7 +97,7 @@ enum drbd_req_event { ...@@ -97,7 +97,7 @@ enum drbd_req_event {
RECV_ACKED_BY_PEER, RECV_ACKED_BY_PEER,
WRITE_ACKED_BY_PEER, WRITE_ACKED_BY_PEER,
WRITE_ACKED_BY_PEER_AND_SIS, /* and set_in_sync */ WRITE_ACKED_BY_PEER_AND_SIS, /* and set_in_sync */
DISCARD_WRITE, CONFLICT_RESOLVED,
POSTPONE_WRITE, POSTPONE_WRITE,
NEG_ACKED, NEG_ACKED,
BARRIER_ACKED, /* in protocol A and B */ BARRIER_ACKED, /* in protocol A and B */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment