}
-/* In C_AHEAD mode only out_of_sync packets are sent for requests. Detach
- * those requests from the newsest barrier when changing to an other cstate.
- *
- * That headless list vanishes when the last request finished its write or
- * send out_of_sync packet. */
-static void tl_forget(struct drbd_conf *mdev)
-{
- struct drbd_tl_epoch *b;
-
- if (test_bit(CREATE_BARRIER, &mdev->flags))
- return;
-
- b = mdev->newest_tle;
- list_del(&b->requests);
- _tl_add_barrier(mdev, b);
-}
-
/**
* _tl_restart() - Walks the transfer log, and applies an action to all requests
* @mdev: DRBD device.
if (os.conn < C_CONNECTED && ns.conn >= C_CONNECTED)
drbd_resume_al(mdev);
- /* Start a new epoch in case we start to mirror write requests */
- if (!drbd_should_do_remote(os) && drbd_should_do_remote(ns))
- tl_forget(mdev);
-
- /* Do not add local-only requests to an epoch with mirrored requests */
- if (drbd_should_do_remote(os) && !drbd_should_do_remote(ns))
- set_bit(CREATE_BARRIER, &mdev->flags);
-
ascw = kmalloc(sizeof(*ascw), GFP_ATOMIC);
if (ascw) {
ascw->os = os;
dev_err(DEV, "FIXME (barrier_acked but pending)\n");
list_move(&req->tl_requests, &mdev->out_of_sequence_requests);
}
- D_ASSERT(req->rq_state & RQ_NET_SENT);
- req->rq_state |= RQ_NET_DONE;
- if (mdev->net_conf->wire_protocol == DRBD_PROT_A)
- atomic_sub(req->size>>9, &mdev->ap_in_flight);
+ if ((req->rq_state & RQ_NET_MASK) != 0) {
+ req->rq_state |= RQ_NET_DONE;
+ if (mdev->net_conf->wire_protocol == DRBD_PROT_A)
+ atomic_sub(req->size>>9, &mdev->ap_in_flight);
+ }
_req_may_be_done(req, m); /* Allowed while state.susp */
break;