public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Milton Miller <miltonm@bga.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi-ioctl: use clock_t <> jiffies
Date: Mon, 17 Nov 2008 13:08:48 +0100	[thread overview]
Message-ID: <20081117120847.GL26778@kernel.dk> (raw)
In-Reply-To: <31226729703643c98694.1714636915.miltonm@bga.com>

On Sat, Nov 15 2008, Milton Miller wrote:
> Convert the timeout ioctl scalling to use the clock_t functions
> which are much more accurate with some USER_HZ vs HZ combinations.
> 
> Signed-off-by: Milton Miller <miltonm@bga.com>
> ---
> While doing some work with low HZ rates for a simulator, 
> I saw a divide-by-zero warning that pointed out these 
> hz scales.
> 
> 
> Index: sim/block/scsi_ioctl.c
> ===================================================================
> --- sim.orig/block/scsi_ioctl.c	2008-11-11 01:19:29.000000000 -0600
> +++ sim/block/scsi_ioctl.c	2008-11-11 01:22:11.000000000 -0600
> @@ -60,7 +60,7 @@ static int scsi_get_bus(struct request_q
>  
>  static int sg_get_timeout(struct request_queue *q)
>  {
> -	return q->sg_timeout / (HZ / USER_HZ);
> +	return jiffies_to_clock_t(q->sg_timeout);
>  }
>  
>  static int sg_set_timeout(struct request_queue *q, int __user *p)
> @@ -68,7 +68,7 @@ static int sg_set_timeout(struct request
>  	int timeout, err = get_user(timeout, p);
>  
>  	if (!err)
> -		q->sg_timeout = timeout * (HZ / USER_HZ);
> +		q->sg_timeout = clock_t_to_jiffies(timeout);
>  
>  	return err;
>  }

Thanks, applied to for-2.6.29

-- 
Jens Axboe


           reply	other threads:[~2008-11-17 12:10 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <31226729703643c98694.1714636915.miltonm@bga.com>]

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=20081117120847.GL26778@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miltonm@bga.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox