drbd: further converge progress display of resync and online-verify
authorLars Ellenberg <lars.ellenberg@linbit.com>
Tue, 9 Nov 2010 13:15:24 +0000 (14:15 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 10 Mar 2011 10:19:06 +0000 (11:19 +0100)
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>
drivers/block/drbd/drbd_proc.c
drivers/block/drbd/drbd_receiver.c

index 07368b75392ab3fcb155d8ef2d94879d1019db48..329b66a91e4493e22f3f5e72d94e9500bb43837f 100644 (file)
@@ -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);
index 1c56af03c38b2f11dd9435ccda7898e378ce0b2b..d0e19a242af45db4e8d79b47ae84f0c656dc1605 100644 (file)
@@ -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);