linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: linux-scsi@vger.kernel.org
Subject: Re: [RFC] [PATCH 1/1] blk request timeout handler patches
Date: Tue, 23 Oct 2007 13:59:42 +0200	[thread overview]
Message-ID: <20071023115941.GO5059@kernel.dk> (raw)
In-Reply-To: <20071023014534.GA16702@us.ibm.com>

On Mon, Oct 22 2007, malahal@us.ibm.com wrote:
> Jens Axboe [jens.axboe@oracle.com] wrote:
> > Current code is below, btw. Not a lot of changes, iirc it's just the
> > delete-always, a missing export, delete timer on empty list.
> > 
> > +void blk_add_timer(struct request *req)
> > +{
> > +	struct request_queue *q = req->q;
> > +	unsigned long expiry;
> > +
> > +	BUG_ON(!list_empty(&req->timeout_list));
> > +
> > +	if (req->timeout)
> > +		req->timeout += jiffies;
> > +	else
> > +		req->timeout = jiffies + q->rq_timeout;
> > +
> 
> The meaning of req->timeout is changed here. It was a timeout value, now
> it became an expiry time. If we happen to requeue the request, its
> timeout would be incorrect. Found using scsi_debug! Maybe, make it a
> bitfield to avoid another field...

Yes, I did that deliberately, did expect some fallout... Note how I
changed ->timeout to be an unsigned long as well.

> > +	list_add_tail(&req->timeout_list, &q->timeout_list);
> > +
> > +	/*
> > +	 * If the timer isn't already pending or this timeout is earlier
> > +	 * than an existing one, modify the timer. Round to next nearest
> > +	 * second.
> > +	 */
> > +	expiry = round_jiffies(req->timeout);
> > +	if (!timer_pending(&q->timeout) ||
> > +	    time_before(expiry, q->timeout.expires))
> > +		mod_timer(&q->timeout, expiry);
> 
> How about changing q->timeout to q->timer?

There are more timers in the queue, ->timer doesn't tell you what it's
for. I considered ->timeout_timer, but it's a bit long.

> > diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c
> > index 32982eb..22a9013 100644
> > --- a/drivers/scsi/gdth_proc.c
> > +++ b/drivers/scsi/gdth_proc.c
> > @@ -846,19 +846,19 @@ static int gdth_update_timeout(int hanum, Scsi_Cmnd *scp, int timeout)
> >  {
> >      int oldto;
> > 
> > -    oldto = scp->timeout_per_command;
> > -    scp->timeout_per_command = timeout;
> > +    oldto = scp->request->timeout;
> > +    scp->request->timeout = timeout;
> > 
> >      if (timeout == 0) {
> > -        del_timer(&scp->eh_timeout);
> > -        scp->eh_timeout.data = (unsigned long) NULL;
> > -        scp->eh_timeout.expires = 0;
> > +        del_timer(&scp->request->timer);
> > +        scp->request->timer.data = (unsigned long) NULL;
> > +        scp->request->timer.expires = 0;
> 
> request doesn't have "timer" field, code compilation fails for this
> file.

Thanks, will fix that up.

-- 
Jens Axboe


  parent reply	other threads:[~2007-10-23 12:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-04 18:12 [RFC] [PATCH 0/2] blk request timeout handler patches malahal
2007-10-04 18:17 ` [RFC] [PATCH 1/2] " malahal
2007-10-04 18:52   ` Randy Dunlap
2007-10-04 20:40   ` Salyzyn, Mark
2007-10-05 12:49   ` Jens Axboe
2007-10-08  6:54     ` malahal
2007-10-08  7:04       ` Jens Axboe
2007-10-09  5:36     ` [RFC] [PATCH 1/1] " malahal
2007-10-09  9:14       ` Jens Axboe
2007-10-09 14:26         ` malahal
2007-10-09 12:00       ` Matthew Wilcox
2007-10-09 12:15         ` Jens Axboe
2007-10-09 15:56           ` James Bottomley
2007-10-09 17:23             ` malahal
2007-10-10 12:25             ` Jens Axboe
2007-10-10 16:58               ` malahal
2007-10-10 17:04                 ` Jens Axboe
2007-10-11 18:01               ` malahal
2007-10-11 18:24                 ` Jens Axboe
2007-10-11 18:33                   ` Jens Axboe
2007-10-23  1:45                     ` malahal
2007-10-23  6:30                       ` malahal
2007-10-23 11:59                       ` Jens Axboe [this message]
2007-10-05 12:50   ` [RFC] [PATCH 1/2] " Jens Axboe
2007-10-04 18:20 ` [RFC] [PATCH 2/2] " malahal
2007-10-04 18:32   ` Randy Dunlap

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=20071023115941.GO5059@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=linux-scsi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).