aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2014-05-08 04:08:05 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2014-07-10 12:35:14 -0400
commitc5a2c1509ea55d074bf0cd8ff0679b247f70cbe3 (patch)
tree66f97073f1dc8a6d72ffea067911e9f1f6e6740e /drivers/block
parent21ae5d7f95aa1a64f35b03c91f8714ced3ab61a9 (diff)
drbd: register peer requests on read_ee early
Initialize peer_request with timestamp and proper empty list head. Add peer_request to list early, so debugfs can find this request and report it as "preparing", even if we sleep before we actually submit it. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/drbd/drbd_receiver.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 2f67dc03d403..42e383513bfc 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -362,17 +362,14 @@ drbd_alloc_peer_req(struct drbd_peer_device *peer_device, u64 id, sector_t secto
362 goto fail; 362 goto fail;
363 } 363 }
364 364
365 memset(peer_req, 0, sizeof(*peer_req));
366 INIT_LIST_HEAD(&peer_req->w.list);
365 drbd_clear_interval(&peer_req->i); 367 drbd_clear_interval(&peer_req->i);
366 peer_req->i.size = data_size; 368 peer_req->i.size = data_size;
367 peer_req->i.sector = sector; 369 peer_req->i.sector = sector;
368 peer_req->i.local = false; 370 peer_req->submit_jif = jiffies;
369 peer_req->i.waiting = false;
370
371 peer_req->epoch = NULL;
372 peer_req->peer_device = peer_device; 371 peer_req->peer_device = peer_device;
373 peer_req->pages = page; 372 peer_req->pages = page;
374 atomic_set(&peer_req->pending_bios, 0);
375 peer_req->flags = 0;
376 /* 373 /*
377 * The block_id is opaque to the receiver. It is not endianness 374 * The block_id is opaque to the receiver. It is not endianness
378 * converted, and sent back to the sender unchanged. 375 * converted, and sent back to the sender unchanged.
@@ -2668,6 +2665,15 @@ static int receive_DataRequest(struct drbd_connection *connection, struct packet
2668 * we would also throttle its application reads. 2665 * we would also throttle its application reads.
2669 * In that case, throttling is done on the SyncTarget only. 2666 * In that case, throttling is done on the SyncTarget only.
2670 */ 2667 */
2668
2669 /* Even though this may be a resync request, we do add to "read_ee";
2670 * "sync_ee" is only used for resync WRITEs.
2671 * Add to list early, so debugfs can find this request
2672 * even if we have to sleep below. */
2673 spin_lock_irq(&device->resource->req_lock);
2674 list_add_tail(&peer_req->w.list, &device->read_ee);
2675 spin_unlock_irq(&device->resource->req_lock);
2676
2671 if (device->state.peer != R_PRIMARY 2677 if (device->state.peer != R_PRIMARY
2672 && drbd_rs_should_slow_down(device, sector, false)) 2678 && drbd_rs_should_slow_down(device, sector, false))
2673 schedule_timeout_uninterruptible(HZ/10); 2679 schedule_timeout_uninterruptible(HZ/10);
@@ -2679,21 +2685,18 @@ submit_for_resync:
2679 2685
2680submit: 2686submit:
2681 inc_unacked(device); 2687 inc_unacked(device);
2682 spin_lock_irq(&device->resource->req_lock);
2683 list_add_tail(&peer_req->w.list, &device->read_ee);
2684 spin_unlock_irq(&device->resource->req_lock);
2685
2686 if (drbd_submit_peer_request(device, peer_req, READ, fault_type) == 0) 2688 if (drbd_submit_peer_request(device, peer_req, READ, fault_type) == 0)
2687 return 0; 2689 return 0;
2688 2690
2689 /* don't care for the reason here */ 2691 /* don't care for the reason here */
2690 drbd_err(device, "submit failed, triggering re-connect\n"); 2692 drbd_err(device, "submit failed, triggering re-connect\n");
2693
2694out_free_e:
2691 spin_lock_irq(&device->resource->req_lock); 2695 spin_lock_irq(&device->resource->req_lock);
2692 list_del(&peer_req->w.list); 2696 list_del(&peer_req->w.list);
2693 spin_unlock_irq(&device->resource->req_lock); 2697 spin_unlock_irq(&device->resource->req_lock);
2694 /* no drbd_rs_complete_io(), we are dropping the connection anyways */ 2698 /* no drbd_rs_complete_io(), we are dropping the connection anyways */
2695 2699
2696out_free_e:
2697 put_ldev(device); 2700 put_ldev(device);
2698 drbd_free_peer_req(device, peer_req); 2701 drbd_free_peer_req(device, peer_req);
2699 return -EIO; 2702 return -EIO;