aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_main.c
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2010-11-05 04:39:06 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 05:18:51 -0500
commit30b743a2d532af39c9ed13c85d5473f6f620f6c8 (patch)
tree9c995b292e463320003aa8d4a3a502ddc3a09d00 /drivers/block/drbd/drbd_main.c
parent26525618863afcc4aab8b2a83451d37c6f513460 (diff)
drbd: improve online-verify progress tracking
For a partial (resumed) online-verify, initialize rs_total not to total bits, but to number of bits to check in this run, to match the meaning rs_total has for actual resync. 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_main.c')
-rw-r--r--drivers/block/drbd/drbd_main.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 8a43ce0edeed..a1a2cb1eadf1 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -961,6 +961,10 @@ static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state
961/* helper for __drbd_set_state */ 961/* helper for __drbd_set_state */
962static void set_ov_position(struct drbd_conf *mdev, enum drbd_conns cs) 962static void set_ov_position(struct drbd_conf *mdev, enum drbd_conns cs)
963{ 963{
964 if (mdev->agreed_pro_version < 90)
965 mdev->ov_start_sector = 0;
966 mdev->rs_total = drbd_bm_bits(mdev);
967 mdev->ov_position = 0;
964 if (cs == C_VERIFY_T) { 968 if (cs == C_VERIFY_T) {
965 /* starting online verify from an arbitrary position 969 /* starting online verify from an arbitrary position
966 * does not fit well into the existing protocol. 970 * does not fit well into the existing protocol.
@@ -970,11 +974,15 @@ static void set_ov_position(struct drbd_conf *mdev, enum drbd_conns cs)
970 mdev->ov_start_sector = ~(sector_t)0; 974 mdev->ov_start_sector = ~(sector_t)0;
971 } else { 975 } else {
972 unsigned long bit = BM_SECT_TO_BIT(mdev->ov_start_sector); 976 unsigned long bit = BM_SECT_TO_BIT(mdev->ov_start_sector);
973 if (bit >= mdev->rs_total) 977 if (bit >= mdev->rs_total) {
974 mdev->ov_start_sector = 978 mdev->ov_start_sector =
975 BM_BIT_TO_SECT(mdev->rs_total - 1); 979 BM_BIT_TO_SECT(mdev->rs_total - 1);
980 mdev->rs_total = 1;
981 } else
982 mdev->rs_total -= bit;
976 mdev->ov_position = mdev->ov_start_sector; 983 mdev->ov_position = mdev->ov_start_sector;
977 } 984 }
985 mdev->ov_left = mdev->rs_total;
978} 986}
979 987
980static void drbd_resume_al(struct drbd_conf *mdev) 988static void drbd_resume_al(struct drbd_conf *mdev)
@@ -1081,7 +1089,7 @@ int __drbd_set_state(struct drbd_conf *mdev,
1081 if ((os.conn == C_VERIFY_S || os.conn == C_VERIFY_T) && 1089 if ((os.conn == C_VERIFY_S || os.conn == C_VERIFY_T) &&
1082 ns.conn < C_CONNECTED) { 1090 ns.conn < C_CONNECTED) {
1083 mdev->ov_start_sector = 1091 mdev->ov_start_sector =
1084 BM_BIT_TO_SECT(mdev->rs_total - mdev->ov_left); 1092 BM_BIT_TO_SECT(drbd_bm_bits(mdev) - mdev->ov_left);
1085 dev_info(DEV, "Online Verify reached sector %llu\n", 1093 dev_info(DEV, "Online Verify reached sector %llu\n",
1086 (unsigned long long)mdev->ov_start_sector); 1094 (unsigned long long)mdev->ov_start_sector);
1087 } 1095 }
@@ -1106,14 +1114,7 @@ int __drbd_set_state(struct drbd_conf *mdev,
1106 unsigned long now = jiffies; 1114 unsigned long now = jiffies;
1107 int i; 1115 int i;
1108 1116
1109 mdev->ov_position = 0; 1117 set_ov_position(mdev, ns.conn);
1110 mdev->rs_total = drbd_bm_bits(mdev);
1111 if (mdev->agreed_pro_version >= 90)
1112 set_ov_position(mdev, ns.conn);
1113 else
1114 mdev->ov_start_sector = 0;
1115 mdev->ov_left = mdev->rs_total
1116 - BM_SECT_TO_BIT(mdev->ov_position);
1117 mdev->rs_start = now; 1118 mdev->rs_start = now;
1118 mdev->rs_last_events = 0; 1119 mdev->rs_last_events = 0;
1119 mdev->rs_last_sect_ev = 0; 1120 mdev->rs_last_sect_ev = 0;
@@ -1121,7 +1122,7 @@ int __drbd_set_state(struct drbd_conf *mdev,
1121 mdev->ov_last_oos_start = 0; 1122 mdev->ov_last_oos_start = 0;
1122 1123
1123 for (i = 0; i < DRBD_SYNC_MARKS; i++) { 1124 for (i = 0; i < DRBD_SYNC_MARKS; i++) {
1124 mdev->rs_mark_left[i] = mdev->rs_total; 1125 mdev->rs_mark_left[i] = mdev->ov_left;
1125 mdev->rs_mark_time[i] = now; 1126 mdev->rs_mark_time[i] = now;
1126 } 1127 }
1127 1128