drbd: cleanup: change "<= 0" to "== 0"
Subsystems (3)
PATCH 1/1 drbd: cleanup: change "<= 0" to "== 0"
dt is unsigned so it's never less than zero. We are calculating the elapsed time, and that's never less than zero (unless there is a bug or we invent time travel). The comparison here is just to guard against divide by zero bugs.
drivers/block/drbd/drbd_proc.c +1 -1
@@ -118,7 +118,7 @@ static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq)/* mean speed since syncer started * we do account for PausedSync periods */ dt = (jiffies - mdev->rs_start - mdev->rs_paused) /HZ ; -if (dt <=0 ) +if (dt =0 ) dt =1 ; db = mdev->rs_total - rs_left; dbdt =Bit2KB (db/dt);
Quoted 12 lines · Dan Carpenter
dt is unsigned so it's never less than zero. We are calculating the elapsed time, and that's never less than zero (unless there is a bug or we invent time travel). The comparison here is just to guard against divide by zero bugs.
Signed-off-by Dan Carpenter <[email protected]>drivers/block/drbd/drbd_proc.c +0
-0
drivers/block/drbd/drbd_proc.c static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq) · line 124
Quoted 8 lines
drivers/block/drbd/drbd_proc.c +1
-1@@ -118,7 +118,7 @@ static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq)/* mean speed since syncer started * we do account for PausedSync periods */ dt = (jiffies - mdev->rs_start - mdev->rs_paused) /HZ ; -if (dt <=0 ) +if (dt ==0 ) dt =1 ; db = mdev->rs_total - rs_left; dbdt =Bit2KB (db/dt);
Lars et al, I'll let you pick this up.
Signature · 1 line
Jens Axboe
Philipp Reisner
maintainerAm Montag, 23. August 2010, um 12:34:29 schrieb Jens Axboe:
Quoted 24 lines · Dan Carpenter
Quoted 23 lines
dt is unsigned so it's never less than zero. We are calculating the elapsed time, and that's never less than zero (unless there is a bug or we invent time travel). The comparison here is just to guard against divide by zero bugs.
Signed-off-by Dan Carpenter <[email protected]>(quoted diff) +0
-0
b/drivers/block/drbd/drbd_proc.cindex be3374b..4c0c4aa 100644drivers/block/drbd/drbd_proc.c +1
-1@@ -118,7 +118,7 @@ static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq)/* mean speed since syncer started * we do account for PausedSync periods */ dt = (jiffies - mdev->rs_start - mdev->rs_paused) /HZ ; -if (dt <=0 ) +if (dt ==0 )
Quoted 6 lines
drivers/block/drbd/drbd_proc.c static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq) · line 124
Quoted 4 lines
drivers/block/drbd/drbd_proc.c +0
-0dt =1 ; db = mdev->rs_total - rs_left; dbdt =Bit2KB (db/dt);Lars et al, I'll let you pick this up.
Jens, we (LINBIT) feel responsible for picking this up. I work on that tomorrow.
Best,
Phil
Signature · 6 lines
: Dipl-Ing Philipp Reisner : LINBIT | Your Way to High Availability : Tel: +43-1-8178292-50, Fax: +43-1-8178292-82 : http://www.linbit.com DRBD(R) and LINBIT(R) are registered trademarks of LINBIT, Austria.
Philipp Reisner
maintainerAm Donnerstag, 12. August 2010, um 00:38:45 schrieb Dan Carpenter:
Quoted 12 lines
dt is unsigned so it's never less than zero. We are calculating the elapsed time, and that's never less than zero (unless there is a bug or we invent time travel). The comparison here is just to guard against divide by zero bugs.
Signed-off-by Dan Carpenter <[email protected]>(quoted diff) +0
-0
b/drivers/block/drbd/drbd_proc.cindex be3374b..4c0c4aa 100644
drivers/block/drbd/drbd_proc.c static void drbd_syncer_progress(struct drbd_conf · line 124
Quoted 8 lines
drivers/block/drbd/drbd_proc.c +1
-1@@ -118,7 +118,7 @@ static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq) /* mean speed since syncer started* we do account for PausedSync periods */ dt = (jiffies - mdev->rs_start - mdev->rs_paused) /HZ ; -if (dt <=0 ) +if (dt ==0 ) dt =1 ; db = mdev->rs_total - rs_left; dbdt =Bit2KB (db/dt);
Hi Dan,
Please elaborate the improvement this patch brings. dt can actually get negative, on jiffie wrap. I see little value in displaying then a negative resync speed...
Best,
Phil
Signature · 6 lines
: Dipl-Ing Philipp Reisner : LINBIT | Your Way to High Availability : Tel: +43-1-8178292-50, Fax: +43-1-8178292-82 : http://www.linbit.com DRBD(R) and LINBIT(R) are registered trademarks of LINBIT, Austria.
Quoted 24 lines · Philipp Reisner
Am Donnerstag, 12. August 2010, um 00:38:45 schrieb Dan Carpenter:
Quoted 12 lines
dt is unsigned so it's never less than zero. We are calculating the elapsed time, and that's never less than zero (unless there is a bug or we invent time travel). The comparison here is just to guard against divide by zero bugs.
Signed-off-by Dan Carpenter <[email protected]>(quoted diff) +0
-0
b/drivers/block/drbd/drbd_proc.cindex be3374b..4c0c4aa 100644drivers/block/drbd/drbd_proc.c static void drbd_syncer_progress(struct drbd_conf · line 124
Quoted 8 lines
drivers/block/drbd/drbd_proc.c +1
-1@@ -118,7 +118,7 @@ static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq) /* mean speed since syncer started* we do account for PausedSync periods */ dt = (jiffies - mdev->rs_start - mdev->rs_paused) /HZ ; -if (dt <=0 ) +if (dt ==0 ) dt =1 ; db = mdev->rs_total - rs_left; dbdt =Bit2KB (db/dt);Hi Dan,
Quoted 3 lines
Please elaborate the improvement this patch brings. dt can actually get negative, on jiffie wrap. I see little value in displaying then a negative resync speed...
Aren't all members unsigned long? If not, then you have another bug.
Signature · 1 line
Jens Axboe
Philipp Reisner
maintainerAm Dienstag, 24. August 2010, um 10:41:31 schrieb Jens Axboe:
Quoted 30 lines · Philipp Reisner
Quoted 29 lines
Am Donnerstag, 12. August 2010, um 00:38:45 schrieb Dan Carpenter:
Quoted 21 lines
dt is unsigned so it's never less than zero. We are calculating the elapsed time, and that's never less than zero (unless there is a bug or we invent time travel). The comparison here is just to guard against divide by zero bugs.
Signed-off-by Dan Carpenter <[email protected]>(quoted diff) +0
-0
b/drivers/block/drbd/drbd_proc.cindex be3374b..4c0c4aa 100644drivers/block/drbd/drbd_proc.c +1
-1@@ -118,7 +118,7 @@ static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq) /* mean speed since syncer started* we do account for PausedSync periods */ dt = (jiffies - mdev->rs_start - mdev->rs_paused) /HZ ; -if (dt <=0 ) +if (dt ==0 )drivers/block/drbd/drbd_proc.c static void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq) · line 124
Quoted 4 lines
drivers/block/drbd/drbd_proc.c +0
-0dt =1 ; db = mdev->rs_total - rs_left; dbdt =Bit2KB (db/dt);Hi Dan,
Quoted 6 lines
Quoted 3 lines
Please elaborate the improvement this patch brings. dt can actually get negative, on jiffie wrap. I see little value in displaying then a negative resync speed...
Aren't all members unsigned long? If not, then you have another bug.
Um, well that is right. Ok, patch goes in.
Best,
Phil
Signature · 6 lines
: Dipl-Ing Philipp Reisner : LINBIT | Your Way to High Availability : Tel: +43-1-8178292-50, Fax: +43-1-8178292-82 : http://www.linbit.com DRBD(R) and LINBIT(R) are registered trademarks of LINBIT, Austria.