aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_receiver.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_receiver.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_receiver.c')
-rw-r--r--drivers/block/drbd/drbd_receiver.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index ee9238e5932..0630a2e122d 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -1862,10 +1862,11 @@ out_interrupted:
1862 * The current sync rate used here uses only the most recent two step marks, 1862 * The current sync rate used here uses only the most recent two step marks,
1863 * to have a short time average so we can react faster. 1863 * to have a short time average so we can react faster.
1864 */ 1864 */
1865int drbd_rs_should_slow_down(struct drbd_conf *mdev) 1865int drbd_rs_should_slow_down(struct drbd_conf *mdev, sector_t sector)
1866{ 1866{
1867 struct gendisk *disk = mdev->ldev->backing_bdev->bd_contains->bd_disk; 1867 struct gendisk *disk = mdev->ldev->backing_bdev->bd_contains->bd_disk;
1868 unsigned long db, dt, dbdt; 1868 unsigned long db, dt, dbdt;
1869 struct lc_element *tmp;
1869 int curr_events; 1870 int curr_events;
1870 int throttle = 0; 1871 int throttle = 0;
1871 1872
@@ -1873,9 +1874,22 @@ int drbd_rs_should_slow_down(struct drbd_conf *mdev)
1873 if (mdev->sync_conf.c_min_rate == 0) 1874 if (mdev->sync_conf.c_min_rate == 0)
1874 return 0; 1875 return 0;
1875 1876
1877 spin_lock_irq(&mdev->al_lock);
1878 tmp = lc_find(mdev->resync, BM_SECT_TO_EXT(sector));
1879 if (tmp) {
1880 struct bm_extent *bm_ext = lc_entry(tmp, struct bm_extent, lce);
1881 if (test_bit(BME_PRIORITY, &bm_ext->flags)) {
1882 spin_unlock_irq(&mdev->al_lock);
1883 return 0;
1884 }
1885 /* Do not slow down if app IO is already waiting for this extent */
1886 }
1887 spin_unlock_irq(&mdev->al_lock);
1888
1876 curr_events = (int)part_stat_read(&disk->part0, sectors[0]) + 1889 curr_events = (int)part_stat_read(&disk->part0, sectors[0]) +
1877 (int)part_stat_read(&disk->part0, sectors[1]) - 1890 (int)part_stat_read(&disk->part0, sectors[1]) -
1878 atomic_read(&mdev->rs_sect_ev); 1891 atomic_read(&mdev->rs_sect_ev);
1892
1879 if (!mdev->rs_last_events || curr_events - mdev->rs_last_events > 64) { 1893 if (!mdev->rs_last_events || curr_events - mdev->rs_last_events > 64) {
1880 unsigned long rs_left; 1894 unsigned long rs_left;
1881 int i; 1895 int i;
@@ -2060,9 +2074,9 @@ static int receive_DataRequest(struct drbd_conf *mdev, enum drbd_packets cmd, un
2060 * we would also throttle its application reads. 2074 * we would also throttle its application reads.
2061 * In that case, throttling is done on the SyncTarget only. 2075 * In that case, throttling is done on the SyncTarget only.
2062 */ 2076 */
2063 if (mdev->state.peer != R_PRIMARY && drbd_rs_should_slow_down(mdev)) 2077 if (mdev->state.peer != R_PRIMARY && drbd_rs_should_slow_down(mdev, sector))
2064 msleep(100); 2078 schedule_timeout_uninterruptible(HZ/10);
2065 if (drbd_rs_begin_io(mdev, e->sector)) 2079 if (drbd_rs_begin_io(mdev, sector))
2066 goto out_free_e; 2080 goto out_free_e;
2067 2081
2068submit_for_resync: 2082submit_for_resync: