Lines Matching refs:peer_req
81 static void drbd_endio_read_sec_final(struct drbd_peer_request *peer_req) __releases(local) in drbd_endio_read_sec_final() argument
84 struct drbd_peer_device *peer_device = peer_req->peer_device; in drbd_endio_read_sec_final()
88 device->read_cnt += peer_req->i.size >> 9; in drbd_endio_read_sec_final()
89 list_del(&peer_req->w.list); in drbd_endio_read_sec_final()
92 if (test_bit(__EE_WAS_ERROR, &peer_req->flags)) in drbd_endio_read_sec_final()
96 drbd_queue_work(&peer_device->connection->sender_work, &peer_req->w); in drbd_endio_read_sec_final()
102 void drbd_endio_write_sec_final(struct drbd_peer_request *peer_req) __releases(local) in drbd_endio_write_sec_final() argument
105 struct drbd_peer_device *peer_device = peer_req->peer_device; in drbd_endio_write_sec_final()
117 i = peer_req->i; in drbd_endio_write_sec_final()
118 do_al_complete_io = peer_req->flags & EE_CALL_AL_COMPLETE_IO; in drbd_endio_write_sec_final()
119 block_id = peer_req->block_id; in drbd_endio_write_sec_final()
120 peer_req->flags &= ~EE_CALL_AL_COMPLETE_IO; in drbd_endio_write_sec_final()
122 if (peer_req->flags & EE_WAS_ERROR) { in drbd_endio_write_sec_final()
125 if (!__test_and_set_bit(__EE_SEND_WRITE_ACK, &peer_req->flags)) in drbd_endio_write_sec_final()
127 drbd_set_out_of_sync(device, peer_req->i.sector, peer_req->i.size); in drbd_endio_write_sec_final()
131 device->writ_cnt += peer_req->i.size >> 9; in drbd_endio_write_sec_final()
132 list_move_tail(&peer_req->w.list, &device->done_ee); in drbd_endio_write_sec_final()
146 if (peer_req->flags & EE_WAS_ERROR) in drbd_endio_write_sec_final()
173 struct drbd_peer_request *peer_req = bio->bi_private; in drbd_peer_request_endio() local
174 struct drbd_device *device = peer_req->peer_device->device; in drbd_peer_request_endio()
183 (unsigned long long)peer_req->i.sector); in drbd_peer_request_endio()
186 set_bit(__EE_WAS_ERROR, &peer_req->flags); in drbd_peer_request_endio()
189 if (atomic_dec_and_test(&peer_req->pending_bios)) { in drbd_peer_request_endio()
191 drbd_endio_write_sec_final(peer_req); in drbd_peer_request_endio()
193 drbd_endio_read_sec_final(peer_req); in drbd_peer_request_endio()
287 void drbd_csum_ee(struct crypto_shash *tfm, struct drbd_peer_request *peer_req, void *digest) in drbd_csum_ee() argument
290 struct page *page = peer_req->pages; in drbd_csum_ee()
308 len = peer_req->i.size & (PAGE_SIZE - 1); in drbd_csum_ee()
340 struct drbd_peer_request *peer_req = container_of(w, struct drbd_peer_request, w); in w_e_send_csum() local
341 struct drbd_peer_device *peer_device = peer_req->peer_device; in w_e_send_csum()
350 if (unlikely((peer_req->flags & EE_WAS_ERROR) != 0)) in w_e_send_csum()
356 sector_t sector = peer_req->i.sector; in w_e_send_csum()
357 unsigned int size = peer_req->i.size; in w_e_send_csum()
358 drbd_csum_ee(peer_device->connection->csums_tfm, peer_req, digest); in w_e_send_csum()
364 drbd_free_peer_req(device, peer_req); in w_e_send_csum()
365 peer_req = NULL; in w_e_send_csum()
377 if (peer_req) in w_e_send_csum()
378 drbd_free_peer_req(device, peer_req); in w_e_send_csum()
390 struct drbd_peer_request *peer_req; in read_for_csum() local
397 peer_req = drbd_alloc_peer_req(peer_device, ID_SYNCER /* unused */, sector, in read_for_csum()
399 if (!peer_req) in read_for_csum()
402 peer_req->w.cb = w_e_send_csum; in read_for_csum()
404 list_add_tail(&peer_req->w.list, &device->read_ee); in read_for_csum()
408 if (drbd_submit_peer_request(device, peer_req, REQ_OP_READ, in read_for_csum()
417 list_del(&peer_req->w.list); in read_for_csum()
420 drbd_free_peer_req(device, peer_req); in read_for_csum()
1029 static void move_to_net_ee_or_free(struct drbd_device *device, struct drbd_peer_request *peer_req) in move_to_net_ee_or_free() argument
1031 if (drbd_peer_req_has_active_page(peer_req)) { in move_to_net_ee_or_free()
1033 int i = PFN_UP(peer_req->i.size); in move_to_net_ee_or_free()
1037 list_add_tail(&peer_req->w.list, &device->net_ee); in move_to_net_ee_or_free()
1041 drbd_free_peer_req(device, peer_req); in move_to_net_ee_or_free()
1051 struct drbd_peer_request *peer_req = container_of(w, struct drbd_peer_request, w); in w_e_end_data_req() local
1052 struct drbd_peer_device *peer_device = peer_req->peer_device; in w_e_end_data_req()
1057 drbd_free_peer_req(device, peer_req); in w_e_end_data_req()
1062 if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) { in w_e_end_data_req()
1063 err = drbd_send_block(peer_device, P_DATA_REPLY, peer_req); in w_e_end_data_req()
1067 (unsigned long long)peer_req->i.sector); in w_e_end_data_req()
1069 err = drbd_send_ack(peer_device, P_NEG_DREPLY, peer_req); in w_e_end_data_req()
1074 move_to_net_ee_or_free(device, peer_req); in w_e_end_data_req()
1081 static bool all_zero(struct drbd_peer_request *peer_req) in all_zero() argument
1083 struct page *page = peer_req->pages; in all_zero()
1084 unsigned int len = peer_req->i.size; in all_zero()
1112 struct drbd_peer_request *peer_req = container_of(w, struct drbd_peer_request, w); in w_e_end_rsdata_req() local
1113 struct drbd_peer_device *peer_device = peer_req->peer_device; in w_e_end_rsdata_req()
1118 drbd_free_peer_req(device, peer_req); in w_e_end_rsdata_req()
1124 drbd_rs_complete_io(device, peer_req->i.sector); in w_e_end_rsdata_req()
1129 err = drbd_send_ack(peer_device, P_RS_CANCEL, peer_req); in w_e_end_rsdata_req()
1130 } else if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) { in w_e_end_rsdata_req()
1133 if (peer_req->flags & EE_RS_THIN_REQ && all_zero(peer_req)) in w_e_end_rsdata_req()
1134 err = drbd_send_rs_deallocated(peer_device, peer_req); in w_e_end_rsdata_req()
1136 err = drbd_send_block(peer_device, P_RS_DATA_REPLY, peer_req); in w_e_end_rsdata_req()
1146 (unsigned long long)peer_req->i.sector); in w_e_end_rsdata_req()
1148 err = drbd_send_ack(peer_device, P_NEG_RS_DREPLY, peer_req); in w_e_end_rsdata_req()
1151 drbd_rs_failed_io(device, peer_req->i.sector, peer_req->i.size); in w_e_end_rsdata_req()
1156 move_to_net_ee_or_free(device, peer_req); in w_e_end_rsdata_req()
1165 struct drbd_peer_request *peer_req = container_of(w, struct drbd_peer_request, w); in w_e_end_csum_rs_req() local
1166 struct drbd_peer_device *peer_device = peer_req->peer_device; in w_e_end_csum_rs_req()
1174 drbd_free_peer_req(device, peer_req); in w_e_end_csum_rs_req()
1180 drbd_rs_complete_io(device, peer_req->i.sector); in w_e_end_csum_rs_req()
1184 di = peer_req->digest; in w_e_end_csum_rs_req()
1186 if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) { 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()
1202 drbd_set_in_sync(device, peer_req->i.sector, peer_req->i.size); in w_e_end_csum_rs_req()
1204 device->rs_same_csum += peer_req->i.size >> BM_BLOCK_SHIFT; in w_e_end_csum_rs_req()
1205 err = drbd_send_ack(peer_device, P_RS_IS_IN_SYNC, peer_req); in w_e_end_csum_rs_req()
1208 peer_req->block_id = ID_SYNCER; /* By setting block_id, digest pointer becomes invalid! */ in w_e_end_csum_rs_req()
1209 peer_req->flags &= ~EE_HAS_DIGEST; /* This peer request no longer has a digest pointer */ in w_e_end_csum_rs_req()
1211 err = drbd_send_block(peer_device, P_RS_DATA_REPLY, peer_req); in w_e_end_csum_rs_req()
1214 err = drbd_send_ack(peer_device, P_NEG_RS_DREPLY, peer_req); in w_e_end_csum_rs_req()
1220 move_to_net_ee_or_free(device, peer_req); in w_e_end_csum_rs_req()
1229 struct drbd_peer_request *peer_req = container_of(w, struct drbd_peer_request, w); in w_e_end_ov_req() local
1230 struct drbd_peer_device *peer_device = peer_req->peer_device; in w_e_end_ov_req()
1232 sector_t sector = peer_req->i.sector; in w_e_end_ov_req()
1233 unsigned int size = peer_req->i.size; in w_e_end_ov_req()
1248 if (likely(!(peer_req->flags & EE_WAS_ERROR))) in w_e_end_ov_req()
1249 drbd_csum_ee(peer_device->connection->verify_tfm, peer_req, digest); in w_e_end_ov_req()
1258 drbd_free_peer_req(device, peer_req); in w_e_end_ov_req()
1259 peer_req = NULL; in w_e_end_ov_req()
1267 if (peer_req) in w_e_end_ov_req()
1268 drbd_free_peer_req(device, peer_req); in w_e_end_ov_req()
1286 struct drbd_peer_request *peer_req = container_of(w, struct drbd_peer_request, w); in w_e_end_ov_reply() local
1287 struct drbd_peer_device *peer_device = peer_req->peer_device; in w_e_end_ov_reply()
1291 sector_t sector = peer_req->i.sector; in w_e_end_ov_reply()
1292 unsigned int size = peer_req->i.size; in w_e_end_ov_reply()
1298 drbd_free_peer_req(device, peer_req); in w_e_end_ov_reply()
1306 drbd_rs_complete_io(device, peer_req->i.sector); in w_e_end_ov_reply()
1310 di = peer_req->digest; in w_e_end_ov_reply()
1312 if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) { in w_e_end_ov_reply()
1316 drbd_csum_ee(peer_device->connection->verify_tfm, peer_req, digest); in w_e_end_ov_reply()
1329 drbd_free_peer_req(device, peer_req); in w_e_end_ov_reply()