drbd_req.c (drbd-9.1.10) | : | drbd_req.c (drbd-9.1.11) | ||
---|---|---|---|---|
skipping to change at line 743 | skipping to change at line 743 | |||
if (idx != -1) { | if (idx != -1) { | |||
old_net = req->net_rq_state[idx]; | old_net = req->net_rq_state[idx]; | |||
WRITE_ONCE(req->net_rq_state[idx], (req->net_rq_state[idx] & ~cle ar) | set); | WRITE_ONCE(req->net_rq_state[idx], (req->net_rq_state[idx] & ~cle ar) | set); | |||
connection = peer_device->connection; | connection = peer_device->connection; | |||
} | } | |||
/* no change? */ | /* no change? */ | |||
unchanged = req->local_rq_state == old_local && | unchanged = req->local_rq_state == old_local && | |||
(idx == -1 || req->net_rq_state[idx] == old_net); | (idx == -1 || req->net_rq_state[idx] == old_net); | |||
spin_unlock(&req->rq_lock); | if (unchanged) { | |||
spin_unlock(&req->rq_lock); | ||||
if (unchanged) | ||||
return; | return; | |||
} | ||||
/* intent: get references */ | /* intent: get references */ | |||
kref_get(&req->kref); | kref_get(&req->kref); | |||
if (!(old_local & RQ_LOCAL_PENDING) && (set_local & RQ_LOCAL_PENDING)) | if (!(old_local & RQ_LOCAL_PENDING) && (set_local & RQ_LOCAL_PENDING)) | |||
atomic_inc(&req->completion_ref); | atomic_inc(&req->completion_ref); | |||
if (!(old_net & RQ_NET_PENDING) && (set & RQ_NET_PENDING)) { | if (!(old_net & RQ_NET_PENDING) && (set & RQ_NET_PENDING)) { | |||
inc_ap_pending(peer_device); | inc_ap_pending(peer_device); | |||
atomic_inc(&req->completion_ref); | atomic_inc(&req->completion_ref); | |||
} | } | |||
if (!(old_net & RQ_NET_QUEUED) && (set & RQ_NET_QUEUED)) | if (!(old_net & RQ_NET_QUEUED) && (set & RQ_NET_QUEUED)) { | |||
set_cache_ptr_if_null(&connection->req_not_net_done, req); | set_cache_ptr_if_null(&connection->req_not_net_done, req); | |||
atomic_inc(&req->completion_ref); | ||||
/* This completion ref is necessary to avoid premature completion | ||||
in case a WRITE_ACKED_BY_PEER comes in before the sender can d | ||||
o | ||||
HANDED_OVER_TO_NETWORK. */ | ||||
} | ||||
if (!(old_net & RQ_EXP_BARR_ACK) && (set & RQ_EXP_BARR_ACK)) | if (!(old_net & RQ_EXP_BARR_ACK) && (set & RQ_EXP_BARR_ACK)) | |||
kref_get(&req->kref); /* wait for the DONE */ | kref_get(&req->kref); /* wait for the DONE */ | |||
if (!(old_net & RQ_NET_SENT) && (set & RQ_NET_SENT)) { | if (!(old_net & RQ_NET_SENT) && (set & RQ_NET_SENT)) { | |||
/* potentially already completed in the ack_receiver thread */ | /* potentially already completed in the ack_receiver thread */ | |||
if (!(old_net & RQ_NET_DONE)) | if (!(old_net & RQ_NET_DONE)) | |||
atomic_add(req_payload_sectors(req), &peer_device->connec tion->ap_in_flight); | atomic_add(req_payload_sectors(req), &peer_device->connec tion->ap_in_flight); | |||
if (req->net_rq_state[idx] & RQ_NET_PENDING) | if (req->net_rq_state[idx] & RQ_NET_PENDING) | |||
set_cache_ptr_if_null(&connection->req_ack_pending, req); | set_cache_ptr_if_null(&connection->req_ack_pending, req); | |||
} | } | |||
if (!(old_local & RQ_COMPLETION_SUSP) && (set_local & RQ_COMPLETION_SUSP) ) | if (!(old_local & RQ_COMPLETION_SUSP) && (set_local & RQ_COMPLETION_SUSP) ) | |||
atomic_inc(&req->completion_ref); | atomic_inc(&req->completion_ref); | |||
spin_unlock(&req->rq_lock); | ||||
/* progress: put references */ | /* progress: put references */ | |||
if ((old_local & RQ_COMPLETION_SUSP) && (clear_local & RQ_COMPLETION_SUSP )) | if ((old_local & RQ_COMPLETION_SUSP) && (clear_local & RQ_COMPLETION_SUSP )) | |||
++c_put; | ++c_put; | |||
if (!(old_local & RQ_LOCAL_ABORTED) && (set_local & RQ_LOCAL_ABORTED)) { | if (!(old_local & RQ_LOCAL_ABORTED) && (set_local & RQ_LOCAL_ABORTED)) { | |||
D_ASSERT(req->device, req->local_rq_state & RQ_LOCAL_PENDING); | D_ASSERT(req->device, req->local_rq_state & RQ_LOCAL_PENDING); | |||
++c_put; | ++c_put; | |||
} | } | |||
skipping to change at line 807 | skipping to change at line 814 | |||
} | } | |||
if ((old_net & RQ_NET_PENDING) && (clear & RQ_NET_PENDING)) { | if ((old_net & RQ_NET_PENDING) && (clear & RQ_NET_PENDING)) { | |||
dec_ap_pending(peer_device); | dec_ap_pending(peer_device); | |||
++c_put; | ++c_put; | |||
ktime_get_accounting(req->acked_kt[peer_device->node_id]); | ktime_get_accounting(req->acked_kt[peer_device->node_id]); | |||
advance_cache_ptr(connection, &connection->req_ack_pending, | advance_cache_ptr(connection, &connection->req_ack_pending, | |||
req, RQ_NET_SENT | RQ_NET_PENDING, 0); | req, RQ_NET_SENT | RQ_NET_PENDING, 0); | |||
} | } | |||
if ((old_net & RQ_NET_QUEUED) && (clear & RQ_NET_QUEUED)) | if ((old_net & RQ_NET_QUEUED) && (clear & RQ_NET_QUEUED)) { | |||
++c_put; | ||||
advance_conn_req_next(connection, req); | advance_conn_req_next(connection, req); | |||
} | ||||
if (!(old_net & RQ_NET_DONE) && (set & RQ_NET_DONE)) { | if (!(old_net & RQ_NET_DONE) && (set & RQ_NET_DONE)) { | |||
atomic_t *ap_in_flight = &peer_device->connection->ap_in_flight; | atomic_t *ap_in_flight = &peer_device->connection->ap_in_flight; | |||
if (old_net & RQ_NET_SENT) | if (old_net & RQ_NET_SENT) | |||
atomic_sub(req_payload_sectors(req), ap_in_flight); | atomic_sub(req_payload_sectors(req), ap_in_flight); | |||
if (old_net & RQ_EXP_BARR_ACK) | if (old_net & RQ_EXP_BARR_ACK) | |||
kref_put(&req->kref, drbd_req_destroy); | kref_put(&req->kref, drbd_req_destroy); | |||
ktime_get_accounting(req->net_done_kt[peer_device->node_id]); | ktime_get_accounting(req->net_done_kt[peer_device->node_id]); | |||
End of changes. 7 change blocks. | ||||
5 lines changed or deleted | 15 lines changed or added |