drbd: factor out drbd_rs_controller_reset
authorLars Ellenberg <lars.ellenberg@linbit.com>
Fri, 5 Nov 2010 08:55:18 +0000 (09:55 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 10 Mar 2011 10:18:59 +0000 (11:18 +0100)
Preparation patch to be able to use the auto-throttling resync controller
for online-verify requests as well.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_worker.c

index 7131bf2af6ae704ed9e4f1e0fa26b084c820d36a..85207b275e4112eb2859c7a52d5f00207df94a9c 100644 (file)
@@ -1499,6 +1499,7 @@ extern int drbd_resync_finished(struct drbd_conf *mdev);
 extern int drbd_md_sync_page_io(struct drbd_conf *mdev,
                struct drbd_backing_dev *bdev, sector_t sector, int rw);
 extern void drbd_ov_oos_found(struct drbd_conf*, sector_t, int);
+extern void drbd_rs_controller_reset(struct drbd_conf *mdev);
 
 static inline void ov_oos_print(struct drbd_conf *mdev)
 {
index a050eb0d93bada62ded310338f8c24ddd34e0e44..971e9b3b13ba000c6640ae89f42894b1a8504701 100644 (file)
@@ -1439,6 +1439,17 @@ int drbd_alter_sa(struct drbd_conf *mdev, int na)
        return retcode;
 }
 
+void drbd_rs_controller_reset(struct drbd_conf *mdev)
+{
+       atomic_set(&mdev->rs_sect_in, 0);
+       atomic_set(&mdev->rs_sect_ev, 0);
+       mdev->rs_in_flight = 0;
+       mdev->rs_planed = 0;
+       spin_lock(&mdev->peer_seq_lock);
+       fifo_set(&mdev->rs_plan_s, 0);
+       spin_unlock(&mdev->peer_seq_lock);
+}
+
 /**
  * drbd_start_resync() - Start the resync process
  * @mdev:      DRBD device.
@@ -1556,13 +1567,7 @@ void drbd_start_resync(struct drbd_conf *mdev, enum drbd_conns side)
                        drbd_resync_finished(mdev);
                }
 
-               atomic_set(&mdev->rs_sect_in, 0);
-               atomic_set(&mdev->rs_sect_ev, 0);
-               mdev->rs_in_flight = 0;
-               mdev->rs_planed = 0;
-               spin_lock(&mdev->peer_seq_lock);
-               fifo_set(&mdev->rs_plan_s, 0);
-               spin_unlock(&mdev->peer_seq_lock);
+               drbd_rs_controller_reset(mdev);
                /* ns.conn may already be != mdev->state.conn,
                 * we may have been paused in between, or become paused until
                 * the timer triggers.