From 0aa8264a831f79cf11bdee55d51e766c8e7993c3 Mon Sep 17 00:00:00 2001
From: Philipp Reisner <philipp.reisner@linbit.com>
Date: Tue, 29 Jan 2019 12:21:13 +0100
Subject: [PATCH] drbd: Improve naming of constant SLEEP_TIME ->
 RS_MK_REQS_INTERV

RS_MK_REQS_INTERV stands for resync make requests intervall.
---
 drbd/drbd_int.h      |  2 +-
 drbd/drbd_main.c     |  2 +-
 drbd/drbd_nl.c       |  2 +-
 drbd/drbd_receiver.c |  4 ++--
 drbd/drbd_sender.c   | 16 ++++++++--------
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h
index e4dacf13f137..3e437a2681e4 100644
--- a/drbd/drbd_int.h
+++ b/drbd/drbd_int.h
@@ -1623,7 +1623,7 @@ extern void tl_abort_disk_io(struct drbd_device *device);
  * Bit 1 ==> local node thinks this block needs to be synced.
  */
 
-#define SLEEP_TIME (HZ/10)
+#define RS_MAKE_REQS_INTV (HZ/10)
 
 /* We do bitmap IO in units of 4k blocks.
  * We also still have a hardcoded 4k per bit relation. */
diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c
index 84da0c1d9fb0..3bff25117332 100644
--- a/drbd/drbd_main.c
+++ b/drbd/drbd_main.c
@@ -1538,7 +1538,7 @@ int drbd_attach_peer_device(struct drbd_peer_device *peer_device) __must_hold(lo
 	pdc = rcu_dereference_protected(peer_device->conf,
 		lockdep_is_held(&peer_device->device->resource->conf_update));
 
-	resync_plan = fifo_alloc((pdc->c_plan_ahead * 10 * SLEEP_TIME) / HZ);
+	resync_plan = fifo_alloc((pdc->c_plan_ahead * 10 * RS_MAKE_REQS_INTV) / HZ);
 	if (!resync_plan)
 		goto out;
 	resync_lru = lc_create("resync", drbd_bm_ext_cache,
diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c
index ca4cf4e48d99..417d7d35eeb1 100644
--- a/drbd/drbd_nl.c
+++ b/drbd/drbd_nl.c
@@ -3420,7 +3420,7 @@ static int adjust_resync_fifo(struct drbd_peer_device *peer_device,
 	struct fifo_buffer *old_plan, *new_plan = NULL;
 	int fifo_size;
 
-	fifo_size = (conf->c_plan_ahead * 10 * SLEEP_TIME) / HZ;
+	fifo_size = (conf->c_plan_ahead * 10 * RS_MAKE_REQS_INTV) / HZ;
 
 	old_plan = rcu_dereference_protected(peer_device->rs_plan_s,
 			     lockdep_is_held(&peer_device->connection->resource->conf_update));
diff --git a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c
index 4e8708375e15..de1fb9f36cdd 100644
--- a/drbd/drbd_receiver.c
+++ b/drbd/drbd_receiver.c
@@ -4595,7 +4595,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
 			new_peer_device_conf->c_fill_target = be32_to_cpu(p->c_fill_target);
 			new_peer_device_conf->c_max_rate = be32_to_cpu(p->c_max_rate);
 
-			fifo_size = (new_peer_device_conf->c_plan_ahead * 10 * SLEEP_TIME) / HZ;
+			fifo_size = (new_peer_device_conf->c_plan_ahead * 10 * RS_MAKE_REQS_INTV) / HZ;
 			old_plan = rcu_dereference_protected(peer_device->rs_plan_s,
 				lockdep_is_held(&resource->conf_update));
 			if (!old_plan || fifo_size != old_plan->size) {
@@ -8556,7 +8556,7 @@ static int got_NegRSDReply(struct drbd_connection *connection, struct packet_inf
 			}
 
 			atomic_add(size >> 9, &peer_device->rs_sect_in);
-			mod_timer(&peer_device->resync_timer, jiffies + SLEEP_TIME);
+			mod_timer(&peer_device->resync_timer, jiffies + RS_MAKE_REQS_INTV);
 			break;
 		default:
 			BUG();
diff --git a/drbd/drbd_sender.c b/drbd/drbd_sender.c
index aec2c208d77e..17f25299bf87 100644
--- a/drbd/drbd_sender.c
+++ b/drbd/drbd_sender.c
@@ -569,13 +569,13 @@ static int drbd_rs_controller(struct drbd_peer_device *peer_device, unsigned int
 	pdc = rcu_dereference(peer_device->conf);
 	plan = rcu_dereference(peer_device->rs_plan_s);
 
-	steps = plan->size; /* (pdc->c_plan_ahead * 10 * SLEEP_TIME) / HZ; */
+	steps = plan->size; /* (pdc->c_plan_ahead * 10 * RS_MAKE_REQS_INTV) / HZ; */
 
 	if (peer_device->rs_in_flight + sect_in == 0) { /* At start of resync */
-		want = ((pdc->resync_rate * 2 * SLEEP_TIME) / HZ) * steps;
+		want = ((pdc->resync_rate * 2 * RS_MAKE_REQS_INTV) / HZ) * steps;
 	} else { /* normal path */
 		want = pdc->c_fill_target ? pdc->c_fill_target :
-			sect_in * pdc->c_delay_target * HZ / (SLEEP_TIME * 10);
+			sect_in * pdc->c_delay_target * HZ / (RS_MAKE_REQS_INTV * 10);
 	}
 
 	correction = want - peer_device->rs_in_flight - plan->total;
@@ -593,7 +593,7 @@ static int drbd_rs_controller(struct drbd_peer_device *peer_device, unsigned int
 	if (req_sect < 0)
 		req_sect = 0;
 
-	max_sect = (pdc->c_max_rate * 2 * SLEEP_TIME) / HZ;
+	max_sect = (pdc->c_max_rate * 2 * RS_MAKE_REQS_INTV) / HZ;
 	if (req_sect > max_sect)
 		req_sect = max_sect;
 
@@ -620,10 +620,10 @@ static int drbd_rs_number_requests(struct drbd_peer_device *peer_device)
 	mxb = nc ? nc->max_buffers : 0;
 	if (rcu_dereference(peer_device->rs_plan_s)->size) {
 		number = drbd_rs_controller(peer_device, sect_in) >> (BM_BLOCK_SHIFT - 9);
-		peer_device->c_sync_rate = number * HZ * (BM_BLOCK_SIZE / 1024) / SLEEP_TIME;
+		peer_device->c_sync_rate = number * HZ * (BM_BLOCK_SIZE / 1024) / RS_MAKE_REQS_INTV;
 	} else {
 		peer_device->c_sync_rate = rcu_dereference(peer_device->conf)->resync_rate;
-		number = SLEEP_TIME * peer_device->c_sync_rate  / ((BM_BLOCK_SIZE / 1024) * HZ);
+		number = RS_MAKE_REQS_INTV * peer_device->c_sync_rate  / ((BM_BLOCK_SIZE / 1024) * HZ);
 	}
 	rcu_read_unlock();
 
@@ -818,7 +818,7 @@ next_sector:
 
  requeue:
 	peer_device->rs_in_flight += (i << (BM_BLOCK_SHIFT - 9));
-	mod_timer(&peer_device->resync_timer, jiffies + SLEEP_TIME);
+	mod_timer(&peer_device->resync_timer, jiffies + RS_MAKE_REQS_INTV);
 	put_ldev(device);
 	return 0;
 }
@@ -872,7 +872,7 @@ static int make_ov_request(struct drbd_peer_device *peer_device, int cancel)
  requeue:
 	peer_device->rs_in_flight += (i << (BM_BLOCK_SHIFT - 9));
 	if (i == 0 || !stop_sector_reached)
-		mod_timer(&peer_device->resync_timer, jiffies + SLEEP_TIME);
+		mod_timer(&peer_device->resync_timer, jiffies + RS_MAKE_REQS_INTV);
 	return 1;
 }
 
-- 
2.26.2

