Skip to contentSkip to conversation

drbd: fix throttling on newly created DM backing devices

PATCH Superseded Imre Palik 2 participants 2 messages Sep 3, 2014

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Imre Palik

author
#0 lore raw

PATCH 1/1 drbd: fix throttling on newly created DM backing devices

From: "Palik, Imre" <[email protected]>

If the drbd backing device is a new device mapper device (e.g., a dm-linear mapping of an existing block device that contains data), the counters are initially 0 even though the device contains useful data. This causes throttling until something accesses the drbd device or the backing device.

The patch disables throttling, as long as only resync is responsible for disk activity on a freshly created device.

---
 drivers/block/drbd/drbd_receiver.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/block/drbd/drbd_receiver.c +2 -1
index 9342b8d..511d2eb 100644
@@ -2482,7 +2482,8 @@ bool drbd_rs_c_min_rate_throttle(struct drbd_device *device)
 			atomic_read(&device->rs_sect_ev);
 
 	if (atomic_read(&device->ap_actlog_cnt)
-	    || !device->rs_last_events || curr_events - device->rs_last_events > 64) {
+		|| (curr_events && (!device->rs_last_events
+					|| curr_events - device->rs_last_events > 64))) {
 		unsigned long rs_left;
 		int i;
 
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw
Quoted 10 lines · Imre Palik

From: "Palik, Imre" <[email protected]>

If the drbd backing device is a new device mapper device (e.g., a dm-linear mapping of an existing block device that contains data), the counters are initially 0 even though the device contains useful data. This causes throttling until something accesses the drbd device or the backing device.

The patch disables throttling, as long as only resync is responsible for disk activity on a freshly created device.

You are right, the !device->rs_last_events was supposed to be an indicator of "just started resync, please call once to initialize". But if curr_events stays 0, which is quite possible given the bursty nature of the DRBD resync, that will stay 0, and keep throttling.

I'm not sure I like your patch, though.
We may want to properly initialize rs_last_events instead.

I'll think about that...

Lars Ellenberg

Quoted 24 lines
---
 drivers/block/drbd/drbd_receiver.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/block/drbd/drbd_receiver.c +2 -1
index 9342b8d..511d2eb 100644
@@ -2482,7 +2482,8 @@ bool drbd_rs_c_min_rate_throttle(struct drbd_device *device)
 			atomic_read(&device->rs_sect_ev);
 
 	if (atomic_read(&device->ap_actlog_cnt)
-	    || !device->rs_last_events || curr_events - device->rs_last_events > 64) {
+		|| (curr_events && (!device->rs_last_events
+					|| curr_events - device->rs_last_events > 64))) {
 		unsigned long rs_left;
 		int i;
 
Signature · 1 line
1.7.9.5