diff options
author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2014-04-22 10:37:16 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2014-07-10 12:35:06 -0400 |
commit | 7f34f61490ee87a470cf229069d59b0987f42a59 (patch) | |
tree | e76e93c15ce7283d656f508b5c1c88189bd8be66 | |
parent | f88c5d90ccca70841af88ba9456ba4aac6d10da8 (diff) |
drbd: drbd_rs_number_requests: fix unit mismatch in comparison
We try to limit the number of "in-flight" resync requests.
One condition for that is the amount of requested data should not exceed
half of what can be covered by our "max-buffers" setting.
However we compared number of 4k pages with number of in-flight 512 Byte
sectors, and this extra throttle triggered much earlier than intended.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r-- | drivers/block/drbd/drbd_worker.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index 0b5e4294acf9..9f0acb011f30 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c | |||
@@ -504,9 +504,9 @@ struct fifo_buffer *fifo_alloc(int fifo_size) | |||
504 | static int drbd_rs_controller(struct drbd_device *device, unsigned int sect_in) | 504 | static int drbd_rs_controller(struct drbd_device *device, unsigned int sect_in) |
505 | { | 505 | { |
506 | struct disk_conf *dc; | 506 | struct disk_conf *dc; |
507 | unsigned int want; /* The number of sectors we want in the proxy */ | 507 | unsigned int want; /* The number of sectors we want in-flight */ |
508 | int req_sect; /* Number of sectors to request in this turn */ | 508 | int req_sect; /* Number of sectors to request in this turn */ |
509 | int correction; /* Number of sectors more we need in the proxy*/ | 509 | int correction; /* Number of sectors more we need in-flight */ |
510 | int cps; /* correction per invocation of drbd_rs_controller() */ | 510 | int cps; /* correction per invocation of drbd_rs_controller() */ |
511 | int steps; /* Number of time steps to plan ahead */ | 511 | int steps; /* Number of time steps to plan ahead */ |
512 | int curr_corr; | 512 | int curr_corr; |
@@ -577,8 +577,13 @@ static int drbd_rs_number_requests(struct drbd_device *device) | |||
577 | * potentially causing a distributed deadlock on congestion during | 577 | * potentially causing a distributed deadlock on congestion during |
578 | * online-verify or (checksum-based) resync, if max-buffers, | 578 | * online-verify or (checksum-based) resync, if max-buffers, |
579 | * socket buffer sizes and resync rate settings are mis-configured. */ | 579 | * socket buffer sizes and resync rate settings are mis-configured. */ |
580 | if (mxb - device->rs_in_flight < number) | 580 | |
581 | number = mxb - device->rs_in_flight; | 581 | /* note that "number" is in units of "BM_BLOCK_SIZE" (which is 4k), |
582 | * mxb (as used here, and in drbd_alloc_pages on the peer) is | ||
583 | * "number of pages" (typically also 4k), | ||
584 | * but "rs_in_flight" is in "sectors" (512 Byte). */ | ||
585 | if (mxb - device->rs_in_flight/8 < number) | ||
586 | number = mxb - device->rs_in_flight/8; | ||
582 | 587 | ||
583 | return number; | 588 | return number; |
584 | } | 589 | } |