All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: malahal@us.ibm.com
Cc: linux-scsi@vger.kernel.org, jens.axboe@oracle.com
Subject: Re: [RFC] [PATCH 1/2] blk request timeout handler patches
Date: Thu, 4 Oct 2007 11:52:12 -0700	[thread overview]
Message-ID: <20071004115212.bc6b2f4b.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20071004181750.GB16689@us.ibm.com>

On Thu, 4 Oct 2007 11:17:50 -0700 malahal@us.ibm.com wrote:

> Mike Christie's patches refreshed to 2.6.23-rc8-mm1.
> 
> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
> Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
> 
> 
> diff -r 3697367c6e4d block/ll_rw_blk.c
> --- a/block/ll_rw_blk.c	Thu Sep 27 00:12:13 2007 -0700
> +++ b/block/ll_rw_blk.c	Thu Sep 27 00:13:07 2007 -0700
> @@ -181,6 +181,19 @@ void blk_queue_softirq_done(struct reque
>  
>  EXPORT_SYMBOL(blk_queue_softirq_done);
>  
> +void blk_queue_rq_timeout(struct request_queue *q, unsigned int timeout)
> +{
> +	q->rq_timeout = timeout;
> +}
> +EXPORT_SYMBOL_GPL(blk_queue_rq_timeout);
> +
> +void blk_queue_rq_timed_out(struct request_queue *q, rq_timed_out_fn *fn)
> +{
> +	q->rq_timed_out_fn = fn;
> +}
> +

Drop that blank line.

> +EXPORT_SYMBOL_GPL(blk_queue_rq_timed_out);
> +
>  /**
>   * blk_queue_make_request - define an alternate make_request function for a device
>   * @q:  the request queue for the device to be affected
> @@ -3647,8 +3663,121 @@ static struct notifier_block blk_cpu_not
>  };
>  
>  /**
> + * blk_delete_timer - Delete/cancel timer for a given function.
> + * @req:	request that we are canceling timer for
> + *
> + * Return value:
> + *     1 if we were able to detach the timer.  0 if we blew it, and the
> + *     timer function has already started to run.
> + **/
> +int blk_delete_timer(struct request *req)
> +{
> +	int rtn;
> +
> +	if (!req->q->rq_timed_out_fn)
> +		return 1;
> +
> +	rtn = del_timer(&req->timer);
> +	req->timer.data = (unsigned long)NULL;
> +	req->timer.function = NULL;
> +
> +	return rtn;
> +}
> +

ditto.

> +EXPORT_SYMBOL_GPL(blk_delete_timer);
> +
> +static void blk_rq_timed_out(struct request *req)
> +{
> +	struct request_queue *q = req->q;
> +
> +	switch (q->rq_timed_out_fn(req)) {
> +	case BLK_EH_HANDLED:
> +		__blk_complete_request(req);
> +		return;
> +	case BLK_EH_RESET_TIMER:
> +		blk_add_timer(req);
> +		return;
> +	case BLK_EH_NOT_HANDLED:
> +		/*
> +		 * LLD handles this for now but in the future
> +		 * we can send a request msg to abort the command
> +		 * and we can move more of the generic scsi eh code to
> +		 * the blk layer.
> +		 */
> +		return;
> +	}
> +}
> +
> +/**
> + * blk_abort_req -- Request request recovery for the specified command
> + * req:		pointer to the request of interest
> + *

s/req:/@req:/

> + * This function requests that the block layer start recovery for the
> + * request by deleting the timer and calling the q's timeout function.
> + * LLDDs who implement their own error recovery MAY ignore the timeout
> + * event if they generated blk_abort_req.
> + */
> +void blk_abort_req(struct request *req)
> +{
> +        if (!blk_delete_timer(req))
> +                return;
> +        blk_rq_timed_out(req);
> +}
> +

drop blank line between closing } of function and the following
EXPORT_SYMBOL...

> +EXPORT_SYMBOL_GPL(blk_abort_req);
> +
> +/**
> + * blk_add_timer - Start timeout timer for a single request
> + * @req:	request that is about to start running.
> + *
> + * Notes:
> + *    Each request has its own timer, and as it is added to the queue, we
> + *    set up the timer.  When the request completes, we cancel the timer.
> + **/

    */

> +void blk_add_timer(struct request *req)
> +{
> +	struct request_queue *q = req->q;
> +
> +	/*
> +	 * If the clock was already running for this command, then
> +	 * first delete the timer.  The timer handling code gets rather
> +	 * confused if we don't do this.
> +	 */
> +	if (req->timer.function)
> +		del_timer(&req->timer);
> +
> +	req->timer.data = (unsigned long)req;
> +	if (req->timeout)
> +		req->timer.expires = jiffies + req->timeout;
> +	else
> +		req->timer.expires = jiffies + q->rq_timeout;
> +	req->timer.function = (void (*)(unsigned long))blk_rq_timed_out;
> +        add_timer(&req->timer);
> +}
> +

drop blank line.  Please just check the rest of them.

> +EXPORT_SYMBOL_GPL(blk_add_timer);
> +
> +/**
>   * blk_complete_request - end I/O on a request
> - * @req:      the request being processed
> + * @req:	the request being processed
>   *
>   * Description:
>   *     Ends all I/O on a request. It does not handle partial completions,
> @@ -3657,25 +3786,24 @@ static struct notifier_block blk_cpu_not
>   *     through a softirq handler. The user must have registered a completion
>   *     callback through blk_queue_softirq_done().
>   **/

    */

> -
>  void blk_complete_request(struct request *req)
>  {


---
~Randy

  reply	other threads:[~2007-10-04 18:52 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 [this message]
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
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=20071004115212.bc6b2f4b.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=malahal@us.ibm.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 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.