Lines Matching defs:connection

96 	drbd_queue_work(&peer_device->connection->sender_work, &peer_req->w);
107 struct drbd_connection *connection = peer_device->connection;
149 if (connection->cstate >= C_WF_REPORT_PARAMS) {
151 if (!queue_work(connection->ack_sender, &peer_device->send_acks_work))
353 digest_size = crypto_shash_digestsize(peer_device->connection->csums_tfm);
358 drbd_csum_ee(peer_device->connection->csums_tfm, peer_req, digest);
448 &first_peer_device(device)->connection->sender_work,
588 struct drbd_connection *const connection = peer_device ? peer_device->connection : NULL;
616 if (connection->agreed_features & DRBD_FF_THIN_RESYNC) {
630 mutex_lock(&connection->data.mutex);
631 if (connection->data.socket) {
632 struct sock *sk = connection->data.socket->sk;
642 mutex_unlock(&connection->data.mutex);
844 struct drbd_connection *connection = first_peer_device(device)->connection;
846 clear_bit(GOT_PING_ACK, &connection->flags);
847 request_ping(connection);
848 wait_event(connection->ping_wait,
849 test_bit(GOT_PING_ACK, &connection->flags) || device->state.conn < C_CONNECTED);
855 struct drbd_connection *connection = peer_device->connection;
877 drbd_queue_work(&connection->sender_work, &dw->w);
1003 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
1011 conn_khelper(connection, "unfence-peer");
1051 * @cancel: The connection will be closed anyways
1112 * @cancel: The connection will be closed anyways
1194 if (peer_device->connection->csums_tfm) {
1195 digest_size = crypto_shash_digestsize(peer_device->connection->csums_tfm);
1200 drbd_csum_ee(peer_device->connection->csums_tfm, peer_req, digest);
1245 digest_size = crypto_shash_digestsize(peer_device->connection->verify_tfm);
1248 err = 1; /* terminate the connection in case the allocation failed */
1253 drbd_csum_ee(peer_device->connection->verify_tfm, peer_req, digest);
1318 digest_size = crypto_shash_digestsize(peer_device->connection->verify_tfm);
1321 drbd_csum_ee(peer_device->connection->verify_tfm, peer_req, digest);
1367 static int drbd_send_barrier(struct drbd_connection *connection)
1372 sock = &connection->data;
1373 p = conn_prepare_command(connection, sock);
1376 p->barrier = connection->send.current_epoch_nr;
1378 connection->send.current_epoch_writes = 0;
1379 connection->send.last_sent_barrier_jif = jiffies;
1381 return conn_send_command(connection, sock, P_BARRIER, sizeof(*p), NULL, 0);
1386 struct drbd_socket *sock = &pd->connection->data;
1402 static void re_init_if_first_write(struct drbd_connection *connection, unsigned int epoch)
1404 if (!connection->send.seen_any_write_yet) {
1405 connection->send.seen_any_write_yet = true;
1406 connection->send.current_epoch_nr = epoch;
1407 connection->send.current_epoch_writes = 0;
1408 connection->send.last_sent_barrier_jif = jiffies;
1412 static void maybe_send_barrier(struct drbd_connection *connection, unsigned int epoch)
1414 /* re-init if first write on this connection */
1415 if (!connection->send.seen_any_write_yet)
1417 if (connection->send.current_epoch_nr != epoch) {
1418 if (connection->send.current_epoch_writes)
1419 drbd_send_barrier(connection);
1420 connection->send.current_epoch_nr = epoch;
1429 struct drbd_connection *const connection = peer_device->connection;
1438 /* this time, no connection->send.current_epoch_writes++;
1442 maybe_send_barrier(connection, req->epoch);
1453 * @cancel: The connection will be closed anyways
1460 struct drbd_connection *connection = peer_device->connection;
1470 re_init_if_first_write(connection, req->epoch);
1471 maybe_send_barrier(connection, req->epoch);
1472 connection->send.current_epoch_writes++;
1486 * @cancel: The connection will be closed anyways
1493 struct drbd_connection *connection = peer_device->connection;
1505 maybe_send_barrier(connection, req->epoch);
1718 static bool use_checksum_based_resync(struct drbd_connection *connection, struct drbd_device *device)
1722 csums_after_crash_only = rcu_dereference(connection->net_conf)->csums_after_crash_only;
1724 return connection->agreed_pro_version >= 89 && /* supported? */
1725 connection->csums_tfm && /* configured? */
1741 struct drbd_connection *connection = peer_device ? peer_device->connection : NULL;
1750 if (!connection) {
1751 drbd_err(device, "No connection to peer, aborting!\n");
1764 "dropping connection.\n", r);
1765 conn_request_state(connection, NS(conn, C_DISCONNECTING), CS_HARD);
1777 "dropping connection.\n", r);
1778 conn_request_state(connection,
1786 if (current == connection->worker.task) {
1801 /* Did some connection breakage or IO error race with us? */
1864 device->use_csums = use_checksum_based_resync(connection, device);
1876 if (side == C_SYNC_SOURCE && connection->agreed_pro_version < 96)
1879 if (connection->agreed_pro_version < 95 && device->rs_total == 0) {
1881 * detect connection loss) that can lead to a full sync
1887 * detect connection loss, then waiting for a ping
1895 nc = rcu_dereference(connection->net_conf);
2056 static void do_unqueued_work(struct drbd_connection *connection)
2062 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
2085 static void wait_for_work(struct drbd_connection *connection, struct list_head *work_list)
2091 dequeue_work_batch(&connection->sender_work, work_list);
2102 nc = rcu_dereference(connection->net_conf);
2106 mutex_lock(&connection->data.mutex);
2107 if (connection->data.socket)
2108 tcp_sock_set_cork(connection->data.socket->sk, false);
2109 mutex_unlock(&connection->data.mutex);
2114 prepare_to_wait(&connection->sender_work.q_wait, &wait, TASK_INTERRUPTIBLE);
2115 spin_lock_irq(&connection->resource->req_lock);
2116 spin_lock(&connection->sender_work.q_lock); /* FIXME get rid of this one? */
2117 if (!list_empty(&connection->sender_work.q))
2118 list_splice_tail_init(&connection->sender_work.q, work_list);
2119 spin_unlock(&connection->sender_work.q_lock); /* FIXME get rid of this one? */
2121 spin_unlock_irq(&connection->resource->req_lock);
2127 * epoch. Next incoming request epoch will be connection ->
2133 atomic_read(&connection->current_tle_nr) !=
2134 connection->send.current_epoch_nr;
2135 spin_unlock_irq(&connection->resource->req_lock);
2138 maybe_send_barrier(connection,
2139 connection->send.current_epoch_nr + 1);
2141 if (test_bit(DEVICE_WORK_PENDING, &connection->flags))
2145 if (get_t_state(&connection->worker) != RUNNING)
2153 finish_wait(&connection->sender_work.q_wait, &wait);
2157 nc = rcu_dereference(connection->net_conf);
2160 mutex_lock(&connection->data.mutex);
2161 if (connection->data.socket) {
2163 tcp_sock_set_cork(connection->data.socket->sk, true);
2165 tcp_sock_set_cork(connection->data.socket->sk, false);
2167 mutex_unlock(&connection->data.mutex);
2172 struct drbd_connection *connection = thi->connection;
2182 update_worker_timing_details(connection, wait_for_work);
2183 wait_for_work(connection, &work_list);
2186 if (test_and_clear_bit(DEVICE_WORK_PENDING, &connection->flags)) {
2187 update_worker_timing_details(connection, do_unqueued_work);
2188 do_unqueued_work(connection);
2194 drbd_warn(connection, "Worker got an unexpected signal\n");
2206 update_worker_timing_details(connection, w->cb);
2207 if (w->cb(w, connection->cstate < C_WF_REPORT_PARAMS) == 0)
2209 if (connection->cstate >= C_WF_REPORT_PARAMS)
2210 conn_request_state(connection, NS(conn, C_NETWORK_FAILURE), CS_HARD);
2215 if (test_and_clear_bit(DEVICE_WORK_PENDING, &connection->flags)) {
2216 update_worker_timing_details(connection, do_unqueued_work);
2217 do_unqueued_work(connection);
2222 update_worker_timing_details(connection, w->cb);
2225 dequeue_work_batch(&connection->sender_work, &work_list);
2226 } while (!list_empty(&work_list) || test_bit(DEVICE_WORK_PENDING, &connection->flags));
2229 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {