summaryrefslogtreecommitdiff
path: root/drivers/block/drbd/drbd_req.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2010-10-27 10:21:30 (GMT)
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 10:34:46 (GMT)
commit67531718d8f1259f01ab84c2aa25f7b03c7afd46 (patch)
tree6f76323440f8ce3793b5d5f1a19808207f38db5b /drivers/block/drbd/drbd_req.c
parent422028b1ca4c07995af82a18abced022ff4c296c (diff)
downloadlinux-fsl-qoriq-67531718d8f1259f01ab84c2aa25f7b03c7afd46.tar.xz
drbd: Implemented two new connection states Ahead/Behind
In this connection mode, the ahead node no longer replicates application IO. The behind's disk becomes out dated. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_req.c')
-rw-r--r--drivers/block/drbd/drbd_req.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index 5c60d77..60288fb 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -948,6 +948,29 @@ allocate_barrier:
? queue_for_net_write
: queue_for_net_read);
}
+
+ if (remote && mdev->net_conf->on_congestion != OC_BLOCK) {
+ int congested = 0;
+
+ if (mdev->net_conf->cong_fill &&
+ atomic_read(&mdev->ap_in_flight) >= mdev->net_conf->cong_fill) {
+ dev_info(DEV, "Congestion-fill threshold reached\n");
+ congested = 1;
+ }
+
+ if (mdev->act_log->used >= mdev->net_conf->cong_extents) {
+ dev_info(DEV, "Congestion-extents threshold reached\n");
+ congested = 1;
+ }
+
+ if (congested) {
+ if (mdev->net_conf->on_congestion == OC_PULL_AHEAD)
+ _drbd_set_state(_NS(mdev, conn, C_AHEAD), 0, NULL);
+ else /*mdev->net_conf->on_congestion == OC_DISCONNECT */
+ _drbd_set_state(_NS(mdev, conn, C_DISCONNECTING), 0, NULL);
+ }
+ }
+
spin_unlock_irq(&mdev->req_lock);
kfree(b); /* if someone else has beaten us to it... */