drbd: use the resync controller for online-verify requests as well
authorLars Ellenberg <lars.ellenberg@linbit.com>
Fri, 5 Nov 2010 09:05:47 +0000 (10:05 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 10 Mar 2011 10:19:03 +0000 (11:19 +0100)
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_main.c
drivers/block/drbd/drbd_proc.c
drivers/block/drbd/drbd_receiver.c
drivers/block/drbd/drbd_worker.c

index a1a2cb1eadf1c55734a681a5413299622e269e8a..6afb81f807bd47a86daf583623ee8a9a6865f470 100644 (file)
@@ -1126,6 +1126,8 @@ int __drbd_set_state(struct drbd_conf *mdev,
                        mdev->rs_mark_time[i] = now;
                }
 
+               drbd_rs_controller_reset(mdev);
+
                if (ns.conn == C_VERIFY_S) {
                        dev_info(DEV, "Starting Online Verify from sector %llu\n",
                                        (unsigned long long)mdev->ov_position);
index 0ec6f4b6a4a80b490d286f11cc20a29af9950ec8..fab3fde3477b3af434015b3cb4106083e96189f8 100644 (file)
@@ -154,7 +154,8 @@ static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq)
        seq_printf_with_thousands_grouping(seq, dbdt);
        seq_printf(seq, ")");
 
-       if (mdev->state.conn == C_SYNC_TARGET) {
+       if (mdev->state.conn == C_SYNC_TARGET ||
+           mdev->state.conn == C_VERIFY_S) {
                if (mdev->c_sync_rate > 1000)
                        seq_printf(seq, " want: %d,%03d",
                                   mdev->c_sync_rate / 1000, mdev->c_sync_rate % 1000);
index 10db70a2337660ce27713e63613587a0d279b23c..1c56af03c38b2f11dd9435ccda7898e378ce0b2b 100644 (file)
@@ -1883,8 +1883,12 @@ int drbd_rs_should_slow_down(struct drbd_conf *mdev)
 
                /* sync speed average over the last 2*DRBD_SYNC_MARK_STEP,
                 * approx. */
-               i = (mdev->rs_last_mark + DRBD_SYNC_MARKS-2) % DRBD_SYNC_MARKS;
-               rs_left = drbd_bm_total_weight(mdev) - mdev->rs_failed;
+               i = (mdev->rs_last_mark + DRBD_SYNC_MARKS-1) % DRBD_SYNC_MARKS;
+
+               if (mdev->state.conn == C_VERIFY_S || mdev->state.conn == C_VERIFY_T)
+                       rs_left = mdev->ov_left;
+               else
+                       rs_left = drbd_bm_total_weight(mdev) - mdev->rs_failed;
 
                dt = ((long)jiffies - (long)mdev->rs_mark_time[i]) / HZ;
                if (!dt)
@@ -1992,6 +1996,8 @@ static int receive_DataRequest(struct drbd_conf *mdev, enum drbd_packets cmd, un
                        D_ASSERT(mdev->agreed_pro_version >= 89);
                        e->w.cb = w_e_end_csum_rs_req;
                } else if (cmd == P_OV_REPLY) {
+                       /* track progress, we may need to throttle */
+                       atomic_add(size >> 9, &mdev->rs_sect_in);
                        e->w.cb = w_e_end_ov_reply;
                        dec_rs_pending(mdev);
                        /* drbd_rs_begin_io done when we sent this request,
index 6d111c8515f7752b268f7908285778ae67b9526b..af805efc94d7cfdaf991b68730a775848b0dd43c 100644 (file)
@@ -708,11 +708,7 @@ static int w_make_ov_request(struct drbd_conf *mdev, struct drbd_work *w, int ca
                return 0;
        }
 
-       number = SLEEP_TIME*mdev->sync_conf.rate / ((BM_BLOCK_SIZE/1024)*HZ);
-       if (atomic_read(&mdev->rs_pending_cnt) > number)
-               goto requeue;
-
-       number -= atomic_read(&mdev->rs_pending_cnt);
+       number = drbd_rs_number_requests(mdev);
 
        sector = mdev->ov_position;
        for (i = 0; i < number; i++) {
@@ -741,11 +737,11 @@ static int w_make_ov_request(struct drbd_conf *mdev, struct drbd_work *w, int ca
        mdev->ov_position = sector;
 
  requeue:
+       mdev->rs_in_flight += (i << (BM_BLOCK_SHIFT - 9));
        mod_timer(&mdev->resync_timer, jiffies + SLEEP_TIME);
        return 1;
 }
 
-
 int w_ov_finished(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
        kfree(w);