aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2010-11-09 08:15:24 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 05:19:06 -0500
commit5f9915bbb8e0975ce99f893c29b8e89100b33399 (patch)
tree70606e132030ad46414d9e2d658b748cdaa70ae9
parent18edc0b9d7dac2f74117a0bdb98f2e705eb74d82 (diff)
drbd: further converge progress display of resync and online-verify
Show progressbar and ETA always, with proc_details >= 1 also show the current sector position for both resync and online-verify on both nodes. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r--drivers/block/drbd/drbd_proc.c46
-rw-r--r--drivers/block/drbd/drbd_receiver.c4
2 files changed, 31 insertions, 19 deletions
diff --git a/drivers/block/drbd/drbd_proc.c b/drivers/block/drbd/drbd_proc.c
index 07368b75392a..329b66a91e44 100644
--- a/drivers/block/drbd/drbd_proc.c
+++ b/drivers/block/drbd/drbd_proc.c
@@ -84,7 +84,12 @@ static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq)
84 seq_printf(seq, "."); 84 seq_printf(seq, ".");
85 seq_printf(seq, "] "); 85 seq_printf(seq, "] ");
86 86
87 seq_printf(seq, "sync'ed:%3u.%u%% ", res / 10, res % 10); 87 if (mdev->state.conn == C_VERIFY_S || mdev->state.conn == C_VERIFY_T)
88 seq_printf(seq, "verified:");
89 else
90 seq_printf(seq, "sync'ed:");
91 seq_printf(seq, "%3u.%u%% ", res / 10, res % 10);
92
88 /* if more than 1 GB display in MB */ 93 /* if more than 1 GB display in MB */
89 if (mdev->rs_total > 0x100000L) 94 if (mdev->rs_total > 0x100000L)
90 seq_printf(seq, "(%lu/%lu)M\n\t", 95 seq_printf(seq, "(%lu/%lu)M\n\t",
@@ -130,14 +135,9 @@ static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq)
130 /* this is what drbd_rs_should_slow_down() uses */ 135 /* this is what drbd_rs_should_slow_down() uses */
131 i = (mdev->rs_last_mark + DRBD_SYNC_MARKS-1) % DRBD_SYNC_MARKS; 136 i = (mdev->rs_last_mark + DRBD_SYNC_MARKS-1) % DRBD_SYNC_MARKS;
132 dt = (jiffies - mdev->rs_mark_time[i]) / HZ; 137 dt = (jiffies - mdev->rs_mark_time[i]) / HZ;
133 if (dt > (DRBD_SYNC_MARK_STEP * DRBD_SYNC_MARKS))
134 stalled = 1;
135
136 if (!dt) 138 if (!dt)
137 dt++; 139 dt++;
138 db = mdev->rs_mark_left[i] - rs_left; 140 db = mdev->rs_mark_left[i] - rs_left;
139 rt = (dt * (rs_left / (db/100+1)))/100; /* seconds */
140
141 dbdt = Bit2KB(db/dt); 141 dbdt = Bit2KB(db/dt);
142 seq_printf_with_thousands_grouping(seq, dbdt); 142 seq_printf_with_thousands_grouping(seq, dbdt);
143 seq_printf(seq, " -- "); 143 seq_printf(seq, " -- ");
@@ -156,13 +156,29 @@ static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq)
156 156
157 if (mdev->state.conn == C_SYNC_TARGET || 157 if (mdev->state.conn == C_SYNC_TARGET ||
158 mdev->state.conn == C_VERIFY_S) { 158 mdev->state.conn == C_VERIFY_S) {
159 if (mdev->c_sync_rate > 1000) 159 seq_printf(seq, " want: ");
160 seq_printf(seq, " want: %d,%03d", 160 seq_printf_with_thousands_grouping(seq, mdev->c_sync_rate);
161 mdev->c_sync_rate / 1000, mdev->c_sync_rate % 1000);
162 else
163 seq_printf(seq, " want: %d", mdev->c_sync_rate);
164 } 161 }
165 seq_printf(seq, " K/sec%s\n", stalled ? " (stalled)" : ""); 162 seq_printf(seq, " K/sec%s\n", stalled ? " (stalled)" : "");
163
164 if (proc_details >= 1) {
165 /* 64 bit:
166 * we convert to sectors in the display below. */
167 u64 bm_bits = drbd_bm_bits(mdev);
168 u64 bit_pos;
169 if (mdev->state.conn == C_VERIFY_S ||
170 mdev->state.conn == C_VERIFY_T)
171 bit_pos = bm_bits - mdev->ov_left;
172 else
173 bit_pos = mdev->bm_resync_fo;
174 /* Total sectors may be slightly off for oddly
175 * sized devices. So what. */
176 seq_printf(seq,
177 "\t%3d%% sector pos: %llu/%llu\n",
178 (int)(bit_pos / (bm_bits/100+1)),
179 (unsigned long long) BM_BIT_TO_SECT(bit_pos),
180 (unsigned long long) BM_BIT_TO_SECT(bm_bits));
181 }
166} 182}
167 183
168static void resync_dump_detail(struct seq_file *seq, struct lc_element *e) 184static void resync_dump_detail(struct seq_file *seq, struct lc_element *e)
@@ -269,14 +285,6 @@ static int drbd_seq_show(struct seq_file *seq, void *v)
269 mdev->state.conn == C_VERIFY_T) 285 mdev->state.conn == C_VERIFY_T)
270 drbd_syncer_progress(mdev, seq); 286 drbd_syncer_progress(mdev, seq);
271 287
272 if (mdev->state.conn == C_VERIFY_S || mdev->state.conn == C_VERIFY_T) {
273 unsigned long bm_bits = drbd_bm_bits(mdev);
274 seq_printf(seq, "\t%3d%% %lu/%lu\n",
275 (int)((bm_bits-mdev->ov_left) /
276 (bm_bits/100+1)),
277 bm_bits - mdev->ov_left, bm_bits);
278 }
279
280 if (proc_details >= 1 && get_ldev_if_state(mdev, D_FAILED)) { 288 if (proc_details >= 1 && get_ldev_if_state(mdev, D_FAILED)) {
281 lc_seq_printf_stats(seq, mdev->resync); 289 lc_seq_printf_stats(seq, mdev->resync);
282 lc_seq_printf_stats(seq, mdev->act_log); 290 lc_seq_printf_stats(seq, mdev->act_log);
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 1c56af03c38b..d0e19a242af4 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -1974,6 +1974,8 @@ static int receive_DataRequest(struct drbd_conf *mdev, enum drbd_packets cmd, un
1974 case P_RS_DATA_REQUEST: 1974 case P_RS_DATA_REQUEST:
1975 e->w.cb = w_e_end_rsdata_req; 1975 e->w.cb = w_e_end_rsdata_req;
1976 fault_type = DRBD_FAULT_RS_RD; 1976 fault_type = DRBD_FAULT_RS_RD;
1977 /* used in the sector offset progress display */
1978 mdev->bm_resync_fo = BM_SECT_TO_BIT(sector);
1977 break; 1979 break;
1978 1980
1979 case P_OV_REPLY: 1981 case P_OV_REPLY:
@@ -1995,6 +1997,8 @@ static int receive_DataRequest(struct drbd_conf *mdev, enum drbd_packets cmd, un
1995 if (cmd == P_CSUM_RS_REQUEST) { 1997 if (cmd == P_CSUM_RS_REQUEST) {
1996 D_ASSERT(mdev->agreed_pro_version >= 89); 1998 D_ASSERT(mdev->agreed_pro_version >= 89);
1997 e->w.cb = w_e_end_csum_rs_req; 1999 e->w.cb = w_e_end_csum_rs_req;
2000 /* used in the sector offset progress display */
2001 mdev->bm_resync_fo = BM_SECT_TO_BIT(sector);
1998 } else if (cmd == P_OV_REPLY) { 2002 } else if (cmd == P_OV_REPLY) {
1999 /* track progress, we may need to throttle */ 2003 /* track progress, we may need to throttle */
2000 atomic_add(size >> 9, &mdev->rs_sect_in); 2004 atomic_add(size >> 9, &mdev->rs_sect_in);