lkml.org 
[lkml]   [2012]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 3/4] block: implement runtime pm strategy
On Thu, 5 Jul 2012, Lin Ming wrote:

> When a request is added:
> If device is suspended or is suspending and the request is not a
> PM request, resume the device.
>
> When a request finishes:
> Call pm_runtime_mark_last_busy().
>
> When pick a request:
> If device is resuming/suspending, then only PM request is allowed to go.
> Return NULL for other cases.
>
> Signed-off-by: Lin Ming <ming.m.lin@intel.com>

These changes would look better if you didn't have "#ifdef
CONFIG_PM_RUNTIME" sprinkled throughout the block-layer routines.

Instead, define static helper functions to do your work, and put the
definitions inside a #ifdef block. If CONFIG_PM_RUNTIME isn't enabled,
the helper functions can be empty static inlines.

> --- a/block/elevator.c +++ b/block/elevator.c @@ -536,6 +537,11 @@

> void elv_requeue_request(struct request_queue *q, struct request *rq)
>
> rq->cmd_flags &= ~REQ_STARTED;
>
> +#ifdef CONFIG_PM_RUNTIME
> + /* __elv_add_request will increment the count */
> + if (!(rq->cmd_flags & REQ_PM))
> + q->nr_pending--;
> +#endif

__elv_add_request increments nr_pending even when REQ_PM is set. You
need to be consistent with that behavior.

Alan Stern



\
 
 \ /
  Last update: 2012-07-05 16:41    [W:0.069 / U:2.432 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site