mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 02:05:33 +00:00
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>
This commit is contained in:
parent
18edc0b9d7
commit
5f9915bbb8
@ -84,7 +84,12 @@ static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq)
|
||||
seq_printf(seq, ".");
|
||||
seq_printf(seq, "] ");
|
||||
|
||||
seq_printf(seq, "sync'ed:%3u.%u%% ", res / 10, res % 10);
|
||||
if (mdev->state.conn == C_VERIFY_S || mdev->state.conn == C_VERIFY_T)
|
||||
seq_printf(seq, "verified:");
|
||||
else
|
||||
seq_printf(seq, "sync'ed:");
|
||||
seq_printf(seq, "%3u.%u%% ", res / 10, res % 10);
|
||||
|
||||
/* if more than 1 GB display in MB */
|
||||
if (mdev->rs_total > 0x100000L)
|
||||
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)
|
||||
/* this is what drbd_rs_should_slow_down() uses */
|
||||
i = (mdev->rs_last_mark + DRBD_SYNC_MARKS-1) % DRBD_SYNC_MARKS;
|
||||
dt = (jiffies - mdev->rs_mark_time[i]) / HZ;
|
||||
if (dt > (DRBD_SYNC_MARK_STEP * DRBD_SYNC_MARKS))
|
||||
stalled = 1;
|
||||
|
||||
if (!dt)
|
||||
dt++;
|
||||
db = mdev->rs_mark_left[i] - rs_left;
|
||||
rt = (dt * (rs_left / (db/100+1)))/100; /* seconds */
|
||||
|
||||
dbdt = Bit2KB(db/dt);
|
||||
seq_printf_with_thousands_grouping(seq, dbdt);
|
||||
seq_printf(seq, " -- ");
|
||||
@ -156,13 +156,29 @@ static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq)
|
||||
|
||||
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);
|
||||
else
|
||||
seq_printf(seq, " want: %d", mdev->c_sync_rate);
|
||||
seq_printf(seq, " want: ");
|
||||
seq_printf_with_thousands_grouping(seq, mdev->c_sync_rate);
|
||||
}
|
||||
seq_printf(seq, " K/sec%s\n", stalled ? " (stalled)" : "");
|
||||
|
||||
if (proc_details >= 1) {
|
||||
/* 64 bit:
|
||||
* we convert to sectors in the display below. */
|
||||
u64 bm_bits = drbd_bm_bits(mdev);
|
||||
u64 bit_pos;
|
||||
if (mdev->state.conn == C_VERIFY_S ||
|
||||
mdev->state.conn == C_VERIFY_T)
|
||||
bit_pos = bm_bits - mdev->ov_left;
|
||||
else
|
||||
bit_pos = mdev->bm_resync_fo;
|
||||
/* Total sectors may be slightly off for oddly
|
||||
* sized devices. So what. */
|
||||
seq_printf(seq,
|
||||
"\t%3d%% sector pos: %llu/%llu\n",
|
||||
(int)(bit_pos / (bm_bits/100+1)),
|
||||
(unsigned long long) BM_BIT_TO_SECT(bit_pos),
|
||||
(unsigned long long) BM_BIT_TO_SECT(bm_bits));
|
||||
}
|
||||
}
|
||||
|
||||
static 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)
|
||||
mdev->state.conn == C_VERIFY_T)
|
||||
drbd_syncer_progress(mdev, seq);
|
||||
|
||||
if (mdev->state.conn == C_VERIFY_S || mdev->state.conn == C_VERIFY_T) {
|
||||
unsigned long bm_bits = drbd_bm_bits(mdev);
|
||||
seq_printf(seq, "\t%3d%% %lu/%lu\n",
|
||||
(int)((bm_bits-mdev->ov_left) /
|
||||
(bm_bits/100+1)),
|
||||
bm_bits - mdev->ov_left, bm_bits);
|
||||
}
|
||||
|
||||
if (proc_details >= 1 && get_ldev_if_state(mdev, D_FAILED)) {
|
||||
lc_seq_printf_stats(seq, mdev->resync);
|
||||
lc_seq_printf_stats(seq, mdev->act_log);
|
||||
|
@ -1974,6 +1974,8 @@ static int receive_DataRequest(struct drbd_conf *mdev, enum drbd_packets cmd, un
|
||||
case P_RS_DATA_REQUEST:
|
||||
e->w.cb = w_e_end_rsdata_req;
|
||||
fault_type = DRBD_FAULT_RS_RD;
|
||||
/* used in the sector offset progress display */
|
||||
mdev->bm_resync_fo = BM_SECT_TO_BIT(sector);
|
||||
break;
|
||||
|
||||
case P_OV_REPLY:
|
||||
@ -1995,6 +1997,8 @@ static int receive_DataRequest(struct drbd_conf *mdev, enum drbd_packets cmd, un
|
||||
if (cmd == P_CSUM_RS_REQUEST) {
|
||||
D_ASSERT(mdev->agreed_pro_version >= 89);
|
||||
e->w.cb = w_e_end_csum_rs_req;
|
||||
/* used in the sector offset progress display */
|
||||
mdev->bm_resync_fo = BM_SECT_TO_BIT(sector);
|
||||
} else if (cmd == P_OV_REPLY) {
|
||||
/* track progress, we may need to throttle */
|
||||
atomic_add(size >> 9, &mdev->rs_sect_in);
|
||||
|
Loading…
x
Reference in New Issue
Block a user