Lines Matching full:connection
96 drbd_queue_work(&peer_device->connection->sender_work, &peer_req->w); in drbd_endio_read_sec_final()
107 struct drbd_connection *connection = peer_device->connection; in drbd_endio_write_sec_final() local
149 if (connection->cstate >= C_WF_REPORT_PARAMS) { in drbd_endio_write_sec_final()
151 if (!queue_work(connection->ack_sender, &peer_device->send_acks_work)) in drbd_endio_write_sec_final()
353 digest_size = crypto_shash_digestsize(peer_device->connection->csums_tfm); in w_e_send_csum()
358 drbd_csum_ee(peer_device->connection->csums_tfm, peer_req, digest); in w_e_send_csum()
448 &first_peer_device(device)->connection->sender_work, in resync_timer_fn()
586 struct drbd_connection *const connection = peer_device ? peer_device->connection : NULL; in make_resync_request() local
614 if (connection->agreed_features & DRBD_FF_THIN_RESYNC) { in make_resync_request()
628 mutex_lock(&connection->data.mutex); in make_resync_request()
629 if (connection->data.socket) { in make_resync_request()
630 struct sock *sk = connection->data.socket->sk; in make_resync_request()
640 mutex_unlock(&connection->data.mutex); in make_resync_request()
841 struct drbd_connection *connection = first_peer_device(device)->connection; in ping_peer() local
843 clear_bit(GOT_PING_ACK, &connection->flags); in ping_peer()
844 request_ping(connection); in ping_peer()
845 wait_event(connection->ping_wait, in ping_peer()
846 test_bit(GOT_PING_ACK, &connection->flags) || device->state.conn < C_CONNECTED); in ping_peer()
851 struct drbd_connection *connection = first_peer_device(device)->connection; in drbd_resync_finished() local
873 drbd_queue_work(&connection->sender_work, &dw->w); in drbd_resync_finished()
999 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) { in drbd_resync_finished()
1007 conn_khelper(connection, "unfence-peer"); in drbd_resync_finished()
1047 * @cancel: The connection will be closed anyways
1108 * @cancel: The connection will be closed anyways
1190 if (peer_device->connection->csums_tfm) { in w_e_end_csum_rs_req()
1191 digest_size = crypto_shash_digestsize(peer_device->connection->csums_tfm); in w_e_end_csum_rs_req()
1196 drbd_csum_ee(peer_device->connection->csums_tfm, peer_req, digest); in w_e_end_csum_rs_req()
1241 digest_size = crypto_shash_digestsize(peer_device->connection->verify_tfm); in w_e_end_ov_req()
1244 err = 1; /* terminate the connection in case the allocation failed */ in w_e_end_ov_req()
1249 drbd_csum_ee(peer_device->connection->verify_tfm, peer_req, digest); in w_e_end_ov_req()
1313 digest_size = crypto_shash_digestsize(peer_device->connection->verify_tfm); in w_e_end_ov_reply()
1316 drbd_csum_ee(peer_device->connection->verify_tfm, peer_req, digest); in w_e_end_ov_reply()
1362 static int drbd_send_barrier(struct drbd_connection *connection) in drbd_send_barrier() argument
1367 sock = &connection->data; in drbd_send_barrier()
1368 p = conn_prepare_command(connection, sock); in drbd_send_barrier()
1371 p->barrier = connection->send.current_epoch_nr; in drbd_send_barrier()
1373 connection->send.current_epoch_writes = 0; in drbd_send_barrier()
1374 connection->send.last_sent_barrier_jif = jiffies; in drbd_send_barrier()
1376 return conn_send_command(connection, sock, P_BARRIER, sizeof(*p), NULL, 0); in drbd_send_barrier()
1381 struct drbd_socket *sock = &pd->connection->data; in pd_send_unplug_remote()
1397 static void re_init_if_first_write(struct drbd_connection *connection, unsigned int epoch) in re_init_if_first_write() argument
1399 if (!connection->send.seen_any_write_yet) { in re_init_if_first_write()
1400 connection->send.seen_any_write_yet = true; in re_init_if_first_write()
1401 connection->send.current_epoch_nr = epoch; in re_init_if_first_write()
1402 connection->send.current_epoch_writes = 0; in re_init_if_first_write()
1403 connection->send.last_sent_barrier_jif = jiffies; in re_init_if_first_write()
1407 static void maybe_send_barrier(struct drbd_connection *connection, unsigned int epoch) in maybe_send_barrier() argument
1409 /* re-init if first write on this connection */ in maybe_send_barrier()
1410 if (!connection->send.seen_any_write_yet) in maybe_send_barrier()
1412 if (connection->send.current_epoch_nr != epoch) { in maybe_send_barrier()
1413 if (connection->send.current_epoch_writes) in maybe_send_barrier()
1414 drbd_send_barrier(connection); in maybe_send_barrier()
1415 connection->send.current_epoch_nr = epoch; in maybe_send_barrier()
1424 struct drbd_connection *const connection = peer_device->connection; in w_send_out_of_sync() local
1433 /* this time, no connection->send.current_epoch_writes++; in w_send_out_of_sync()
1437 maybe_send_barrier(connection, req->epoch); in w_send_out_of_sync()
1448 * @cancel: The connection will be closed anyways
1455 struct drbd_connection *connection = peer_device->connection; in w_send_dblock() local
1465 re_init_if_first_write(connection, req->epoch); in w_send_dblock()
1466 maybe_send_barrier(connection, req->epoch); in w_send_dblock()
1467 connection->send.current_epoch_writes++; in w_send_dblock()
1481 * @cancel: The connection will be closed anyways
1488 struct drbd_connection *connection = peer_device->connection; in w_send_read_req() local
1500 maybe_send_barrier(connection, req->epoch); in w_send_read_req()
1712 static bool use_checksum_based_resync(struct drbd_connection *connection, struct drbd_device *devic… in use_checksum_based_resync() argument
1716 csums_after_crash_only = rcu_dereference(connection->net_conf)->csums_after_crash_only; in use_checksum_based_resync()
1718 return connection->agreed_pro_version >= 89 && /* supported? */ in use_checksum_based_resync()
1719 connection->csums_tfm && /* configured? */ in use_checksum_based_resync()
1735 struct drbd_connection *connection = peer_device ? peer_device->connection : NULL; in drbd_start_resync() local
1744 if (!connection) { in drbd_start_resync()
1745 drbd_err(device, "No connection to peer, aborting!\n"); in drbd_start_resync()
1758 "dropping connection.\n", r); in drbd_start_resync()
1759 conn_request_state(connection, NS(conn, C_DISCONNECTING), CS_HARD); in drbd_start_resync()
1771 "dropping connection.\n", r); in drbd_start_resync()
1772 conn_request_state(connection, in drbd_start_resync()
1780 if (current == connection->worker.task) { in drbd_start_resync()
1795 /* Did some connection breakage or IO error race with us? */ in drbd_start_resync()
1858 device->use_csums = use_checksum_based_resync(connection, device); in drbd_start_resync()
1870 if (side == C_SYNC_SOURCE && connection->agreed_pro_version < 96) in drbd_start_resync()
1873 if (connection->agreed_pro_version < 95 && device->rs_total == 0) { in drbd_start_resync()
1875 * detect connection loss) that can lead to a full sync in drbd_start_resync()
1881 * detect connection loss, then waiting for a ping in drbd_start_resync()
1889 nc = rcu_dereference(connection->net_conf); in drbd_start_resync()
2048 static void do_unqueued_work(struct drbd_connection *connection) in do_unqueued_work() argument
2054 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) { in do_unqueued_work()
2077 static void wait_for_work(struct drbd_connection *connection, struct list_head *work_list) in wait_for_work() argument
2083 dequeue_work_batch(&connection->sender_work, work_list); in wait_for_work()
2094 nc = rcu_dereference(connection->net_conf); in wait_for_work()
2098 mutex_lock(&connection->data.mutex); in wait_for_work()
2099 if (connection->data.socket) in wait_for_work()
2100 tcp_sock_set_cork(connection->data.socket->sk, false); in wait_for_work()
2101 mutex_unlock(&connection->data.mutex); in wait_for_work()
2106 prepare_to_wait(&connection->sender_work.q_wait, &wait, TASK_INTERRUPTIBLE); in wait_for_work()
2107 spin_lock_irq(&connection->resource->req_lock); in wait_for_work()
2108 spin_lock(&connection->sender_work.q_lock); /* FIXME get rid of this one? */ in wait_for_work()
2109 if (!list_empty(&connection->sender_work.q)) in wait_for_work()
2110 list_splice_tail_init(&connection->sender_work.q, work_list); in wait_for_work()
2111 spin_unlock(&connection->sender_work.q_lock); /* FIXME get rid of this one? */ in wait_for_work()
2113 spin_unlock_irq(&connection->resource->req_lock); in wait_for_work()
2119 * epoch. Next incoming request epoch will be connection -> in wait_for_work()
2125 atomic_read(&connection->current_tle_nr) != in wait_for_work()
2126 connection->send.current_epoch_nr; in wait_for_work()
2127 spin_unlock_irq(&connection->resource->req_lock); in wait_for_work()
2130 maybe_send_barrier(connection, in wait_for_work()
2131 connection->send.current_epoch_nr + 1); in wait_for_work()
2133 if (test_bit(DEVICE_WORK_PENDING, &connection->flags)) in wait_for_work()
2137 if (get_t_state(&connection->worker) != RUNNING) in wait_for_work()
2145 finish_wait(&connection->sender_work.q_wait, &wait); in wait_for_work()
2149 nc = rcu_dereference(connection->net_conf); in wait_for_work()
2152 mutex_lock(&connection->data.mutex); in wait_for_work()
2153 if (connection->data.socket) { in wait_for_work()
2155 tcp_sock_set_cork(connection->data.socket->sk, true); in wait_for_work()
2157 tcp_sock_set_cork(connection->data.socket->sk, false); in wait_for_work()
2159 mutex_unlock(&connection->data.mutex); in wait_for_work()
2164 struct drbd_connection *connection = thi->connection; in drbd_worker() local
2174 update_worker_timing_details(connection, wait_for_work); in drbd_worker()
2175 wait_for_work(connection, &work_list); in drbd_worker()
2178 if (test_and_clear_bit(DEVICE_WORK_PENDING, &connection->flags)) { in drbd_worker()
2179 update_worker_timing_details(connection, do_unqueued_work); in drbd_worker()
2180 do_unqueued_work(connection); in drbd_worker()
2186 drbd_warn(connection, "Worker got an unexpected signal\n"); in drbd_worker()
2198 update_worker_timing_details(connection, w->cb); in drbd_worker()
2199 if (w->cb(w, connection->cstate < C_WF_REPORT_PARAMS) == 0) in drbd_worker()
2201 if (connection->cstate >= C_WF_REPORT_PARAMS) in drbd_worker()
2202 conn_request_state(connection, NS(conn, C_NETWORK_FAILURE), CS_HARD); in drbd_worker()
2207 if (test_and_clear_bit(DEVICE_WORK_PENDING, &connection->flags)) { in drbd_worker()
2208 update_worker_timing_details(connection, do_unqueued_work); in drbd_worker()
2209 do_unqueued_work(connection); in drbd_worker()
2214 update_worker_timing_details(connection, w->cb); in drbd_worker()
2217 dequeue_work_batch(&connection->sender_work, &work_list); in drbd_worker()
2218 } while (!list_empty(&work_list) || test_bit(DEVICE_WORK_PENDING, &connection->flags)); in drbd_worker()
2221 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) { in drbd_worker()