All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philipp Reisner <philipp.reisner@linbit.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch] drbd: cleanup: change "<= 0" to "== 0"
Date: Tue, 24 Aug 2010 09:10:37 +0000	[thread overview]
Message-ID: <201008241110.37508.philipp.reisner@linbit.com> (raw)
In-Reply-To: <20100811223845.GE645@bicker>

Am Dienstag, 24. August 2010, um 10:41:31 schrieb Jens Axboe:
> On 2010-08-24 10:38, Philipp Reisner wrote:
> > Am Donnerstag, 12. August 2010, um 00:38:45 schrieb 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 <error27@gmail.com>
> >> 
> >> diff --git a/drivers/block/drbd/drbd_proc.c
> >> b/drivers/block/drbd/drbd_proc.c index be3374b..4c0c4aa 100644
> >> --- a/drivers/block/drbd/drbd_proc.c
> >> +++ b/drivers/block/drbd/drbd_proc.c
> >> @@ -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...
> 
> Aren't all members unsigned long? If not, then you have
> another bug.

Um, well that is right. Ok, patch goes in.

Best,
 Phil
-- 
: 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.

WARNING: multiple messages have this Message-ID (diff)
From: Philipp Reisner <philipp.reisner@linbit.com>
To: Jens Axboe <jaxboe@fusionio.com>
Cc: "kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	Sam Ravnborg <sam@ravnborg.org>,
	Dan Carpenter <error27@gmail.com>,
	Lars Ellenberg <drbd-dev@lists.linbit.com>
Subject: Re: [Drbd-dev] [patch] drbd: cleanup: change "<= 0" to "== 0"
Date: Tue, 24 Aug 2010 11:10:37 +0200	[thread overview]
Message-ID: <201008241110.37508.philipp.reisner@linbit.com> (raw)
In-Reply-To: <4C7385BB.9080504@fusionio.com>

Am Dienstag, 24. August 2010, um 10:41:31 schrieb Jens Axboe:
> On 2010-08-24 10:38, Philipp Reisner wrote:
> > Am Donnerstag, 12. August 2010, um 00:38:45 schrieb 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 <error27@gmail.com>
> >> 
> >> diff --git a/drivers/block/drbd/drbd_proc.c
> >> b/drivers/block/drbd/drbd_proc.c index be3374b..4c0c4aa 100644
> >> --- a/drivers/block/drbd/drbd_proc.c
> >> +++ b/drivers/block/drbd/drbd_proc.c
> >> @@ -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...
> 
> Aren't all members unsigned long? If not, then you have
> another bug.

Um, well that is right. Ok, patch goes in.

Best,
 Phil
-- 
: 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.

  parent reply	other threads:[~2010-08-24  9:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-11 22:38 [patch] drbd: cleanup: change "<= 0" to "== 0" Dan Carpenter
2010-08-11 22:38 ` [Drbd-dev] " Dan Carpenter
2010-08-23 10:34 ` Jens Axboe
2010-08-23 10:34   ` [Drbd-dev] " Jens Axboe
2010-08-23 16:03 ` Philipp Reisner
2010-08-23 16:03   ` [Drbd-dev] " Philipp Reisner
2010-08-24  8:38 ` Philipp Reisner
2010-08-24  8:38   ` [Drbd-dev] " Philipp Reisner
2010-08-24  8:41 ` Jens Axboe
2010-08-24  8:41   ` [Drbd-dev] " Jens Axboe
2010-08-24  9:10 ` Philipp Reisner [this message]
2010-08-24  9:10   ` Philipp Reisner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201008241110.37508.philipp.reisner@linbit.com \
    --to=philipp.reisner@linbit.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.