lkml.org 
[lkml]   [2013]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 3/4] block: implement runtime pm strategy
On Tue, 8 Jan 2013, Aaron Lu wrote:

> >> --- a/include/linux/blkdev.h
> >> +++ b/include/linux/blkdev.h
> >> @@ -974,6 +974,40 @@ extern int blk_pre_runtime_suspend(struct request_queue *q);
> >> extern void blk_post_runtime_suspend(struct request_queue *q, int err);
> >> extern void blk_pre_runtime_resume(struct request_queue *q);
> >> extern void blk_post_runtime_resume(struct request_queue *q, int err);
> >> +
> >> +static inline void blk_pm_put_request(struct request *rq)
> >> +{
> >> + if (!(rq->cmd_flags & REQ_PM) && !--rq->q->nr_pending) {
> >> + pm_runtime_mark_last_busy(rq->q->dev);
> >> + pm_runtime_autosuspend(rq->q->dev);
> >> + }
> >> +}
> >> +
> >> +static inline struct request *blk_pm_peek_request(
> >> + struct request_queue *q, struct request *rq)
> >> +{
> >> + if (q->rpm_status == RPM_SUSPENDED ||
> >> + (q->rpm_status != RPM_ACTIVE && !(rq->cmd_flags & REQ_PM)))
> >> + return NULL;
> >> + else
> >> + return rq;
> >> +}
> >> +
> >> +static inline void blk_pm_requeue_request(struct request *rq)
> >> +{
> >> + if (!(rq->cmd_flags & REQ_PM))
> >> + rq->q->nr_pending--;
> >> +}
> >> +
> >> +static inline void blk_pm_add_request(struct request_queue *q,
> >> + struct request *rq)
> >> +{
> >> + if (!(rq->cmd_flags & REQ_PM) &&
> >> + q->nr_pending++ == 0 &&
> >> + (q->rpm_status == RPM_SUSPENDED ||
> >> + q->rpm_status == RPM_SUSPENDING))
> >> + pm_request_resume(q->dev);
> >> +}
> >
> > These routines also don't belong in include/linux. And they don't need
> > to be marked inline.
>
> OK, will move them.
>
> What about create a new file blk-pm.c for all these block pm related
> code?

Sure, go ahead if Jens doesn't mind. Alternatively, you could put each
of these functions in the file where it gets used.

Just as importantly, all of the public routines added in patch 2/4 to
blk-core.c should have kerneldoc explaining how and where to use them.
In particular, the kerneldoc for blk_pm_runtime_init() has to mention
that the block runtime PM implementation works only for drivers that
use request structures for their I/O; it doesn't work for drivers that
use bio's directly.

Alan Stern



\
 
 \ /
  Last update: 2013-01-08 17:01    [W:0.058 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site