aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_worker.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2010-11-07 09:56:29 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 05:34:53 -0500
commite3555d8545976703938d1b59e2db509426dbe02c (patch)
treea29b15c4ab07b51bf6e162ae68796c50718778aa /drivers/block/drbd/drbd_worker.c
parent59817f4fab6a165ba83ce399464ba38432db8233 (diff)
drbd: Implemented priority inheritance for resync requests
We only issue resync requests if there is no significant application IO going on. = Application IO has higher priority than resnyc IO. If application IO can not be started because the resync process locked an resync_lru entry, start the IO operations necessary to release the lock ASAP. 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_worker.c')
-rw-r--r--drivers/block/drbd/drbd_worker.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index 982d68432a0..4008130f2b2 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -355,7 +355,7 @@ static int read_for_csum(struct drbd_conf *mdev, sector_t sector, int size)
355 if (!get_ldev(mdev)) 355 if (!get_ldev(mdev))
356 return -EIO; 356 return -EIO;
357 357
358 if (drbd_rs_should_slow_down(mdev)) 358 if (drbd_rs_should_slow_down(mdev, sector))
359 goto defer; 359 goto defer;
360 360
361 /* GFP_TRY, because if there is no memory available right now, this may 361 /* GFP_TRY, because if there is no memory available right now, this may
@@ -503,16 +503,6 @@ int drbd_rs_number_requests(struct drbd_conf *mdev)
503 number = SLEEP_TIME * mdev->c_sync_rate / ((BM_BLOCK_SIZE / 1024) * HZ); 503 number = SLEEP_TIME * mdev->c_sync_rate / ((BM_BLOCK_SIZE / 1024) * HZ);
504 } 504 }
505 505
506 /* Throttle resync on lower level disk activity, which may also be
507 * caused by application IO on Primary/SyncTarget.
508 * Keep this after the call to drbd_rs_controller, as that assumes
509 * to be called as precisely as possible every SLEEP_TIME,
510 * and would be confused otherwise. */
511 if (number && drbd_rs_should_slow_down(mdev)) {
512 mdev->c_sync_rate = 1;
513 number = 0;
514 }
515
516 /* ignore the amount of pending requests, the resync controller should 506 /* ignore the amount of pending requests, the resync controller should
517 * throttle down to incoming reply rate soon enough anyways. */ 507 * throttle down to incoming reply rate soon enough anyways. */
518 return number; 508 return number;
@@ -594,7 +584,8 @@ next_sector:
594 584
595 sector = BM_BIT_TO_SECT(bit); 585 sector = BM_BIT_TO_SECT(bit);
596 586
597 if (drbd_try_rs_begin_io(mdev, sector)) { 587 if (drbd_rs_should_slow_down(mdev, sector) ||
588 drbd_try_rs_begin_io(mdev, sector)) {
598 mdev->bm_resync_fo = bit; 589 mdev->bm_resync_fo = bit;
599 goto requeue; 590 goto requeue;
600 } 591 }
@@ -719,7 +710,8 @@ static int w_make_ov_request(struct drbd_conf *mdev, struct drbd_work *w, int ca
719 710
720 size = BM_BLOCK_SIZE; 711 size = BM_BLOCK_SIZE;
721 712
722 if (drbd_try_rs_begin_io(mdev, sector)) { 713 if (drbd_rs_should_slow_down(mdev, sector) ||
714 drbd_try_rs_begin_io(mdev, sector)) {
723 mdev->ov_position = sector; 715 mdev->ov_position = sector;
724 goto requeue; 716 goto requeue;
725 } 717 }