Commit e5045454 authored by Jens Axboe's avatar Jens Axboe

blk-rq-qos: inline check for q->rq_qos functions

Put the short code in the fast path, where we don't have any
functions attached to the queue. This minimizes the impact on
the hot path in the core code.

Cc: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 344e9ffc
...@@ -27,74 +27,67 @@ bool rq_wait_inc_below(struct rq_wait *rq_wait, unsigned int limit) ...@@ -27,74 +27,67 @@ bool rq_wait_inc_below(struct rq_wait *rq_wait, unsigned int limit)
return atomic_inc_below(&rq_wait->inflight, limit); return atomic_inc_below(&rq_wait->inflight, limit);
} }
void rq_qos_cleanup(struct request_queue *q, struct bio *bio) void __rq_qos_cleanup(struct rq_qos *rqos, struct bio *bio)
{ {
struct rq_qos *rqos; do {
for (rqos = q->rq_qos; rqos; rqos = rqos->next) {
if (rqos->ops->cleanup) if (rqos->ops->cleanup)
rqos->ops->cleanup(rqos, bio); rqos->ops->cleanup(rqos, bio);
} rqos = rqos->next;
} while (rqos);
} }
void rq_qos_done(struct request_queue *q, struct request *rq) void __rq_qos_done(struct rq_qos *rqos, struct request *rq)
{ {
struct rq_qos *rqos; do {
for (rqos = q->rq_qos; rqos; rqos = rqos->next) {
if (rqos->ops->done) if (rqos->ops->done)
rqos->ops->done(rqos, rq); rqos->ops->done(rqos, rq);
} rqos = rqos->next;
} while (rqos);
} }
void rq_qos_issue(struct request_queue *q, struct request *rq) void __rq_qos_issue(struct rq_qos *rqos, struct request *rq)
{ {
struct rq_qos *rqos; do {
for(rqos = q->rq_qos; rqos; rqos = rqos->next) {
if (rqos->ops->issue) if (rqos->ops->issue)
rqos->ops->issue(rqos, rq); rqos->ops->issue(rqos, rq);
} rqos = rqos->next;
} while (rqos);
} }
void rq_qos_requeue(struct request_queue *q, struct request *rq) void __rq_qos_requeue(struct rq_qos *rqos, struct request *rq)
{ {
struct rq_qos *rqos; do {
for(rqos = q->rq_qos; rqos; rqos = rqos->next) {
if (rqos->ops->requeue) if (rqos->ops->requeue)
rqos->ops->requeue(rqos, rq); rqos->ops->requeue(rqos, rq);
} rqos = rqos->next;
} while (rqos);
} }
void rq_qos_throttle(struct request_queue *q, struct bio *bio) void __rq_qos_throttle(struct rq_qos *rqos, struct bio *bio)
{ {
struct rq_qos *rqos; do {
for(rqos = q->rq_qos; rqos; rqos = rqos->next) {
if (rqos->ops->throttle) if (rqos->ops->throttle)
rqos->ops->throttle(rqos, bio); rqos->ops->throttle(rqos, bio);
} rqos = rqos->next;
} while (rqos);
} }
void rq_qos_track(struct request_queue *q, struct request *rq, struct bio *bio) void __rq_qos_track(struct rq_qos *rqos, struct request *rq, struct bio *bio)
{ {
struct rq_qos *rqos; do {
for(rqos = q->rq_qos; rqos; rqos = rqos->next) {
if (rqos->ops->track) if (rqos->ops->track)
rqos->ops->track(rqos, rq, bio); rqos->ops->track(rqos, rq, bio);
} rqos = rqos->next;
} while (rqos);
} }
void rq_qos_done_bio(struct request_queue *q, struct bio *bio) void __rq_qos_done_bio(struct rq_qos *rqos, struct bio *bio)
{ {
struct rq_qos *rqos; do {
for(rqos = q->rq_qos; rqos; rqos = rqos->next) {
if (rqos->ops->done_bio) if (rqos->ops->done_bio)
rqos->ops->done_bio(rqos, bio); rqos->ops->done_bio(rqos, bio);
} rqos = rqos->next;
} while (rqos);
} }
/* /*
......
...@@ -98,12 +98,57 @@ void rq_depth_scale_up(struct rq_depth *rqd); ...@@ -98,12 +98,57 @@ void rq_depth_scale_up(struct rq_depth *rqd);
void rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle); void rq_depth_scale_down(struct rq_depth *rqd, bool hard_throttle);
bool rq_depth_calc_max_depth(struct rq_depth *rqd); bool rq_depth_calc_max_depth(struct rq_depth *rqd);
void rq_qos_cleanup(struct request_queue *, struct bio *); void __rq_qos_cleanup(struct rq_qos *rqos, struct bio *bio);
void rq_qos_done(struct request_queue *, struct request *); void __rq_qos_done(struct rq_qos *rqos, struct request *rq);
void rq_qos_issue(struct request_queue *, struct request *); void __rq_qos_issue(struct rq_qos *rqos, struct request *rq);
void rq_qos_requeue(struct request_queue *, struct request *); void __rq_qos_requeue(struct rq_qos *rqos, struct request *rq);
void rq_qos_done_bio(struct request_queue *q, struct bio *bio); void __rq_qos_throttle(struct rq_qos *rqos, struct bio *bio);
void rq_qos_throttle(struct request_queue *, struct bio *); void __rq_qos_track(struct rq_qos *rqos, struct request *rq, struct bio *bio);
void rq_qos_track(struct request_queue *q, struct request *, struct bio *); void __rq_qos_done_bio(struct rq_qos *rqos, struct bio *bio);
static inline void rq_qos_cleanup(struct request_queue *q, struct bio *bio)
{
if (q->rq_qos)
__rq_qos_cleanup(q->rq_qos, bio);
}
static inline void rq_qos_done(struct request_queue *q, struct request *rq)
{
if (q->rq_qos)
__rq_qos_done(q->rq_qos, rq);
}
static inline void rq_qos_issue(struct request_queue *q, struct request *rq)
{
if (q->rq_qos)
__rq_qos_issue(q->rq_qos, rq);
}
static inline void rq_qos_requeue(struct request_queue *q, struct request *rq)
{
if (q->rq_qos)
__rq_qos_requeue(q->rq_qos, rq);
}
static inline void rq_qos_done_bio(struct request_queue *q, struct bio *bio)
{
if (q->rq_qos)
__rq_qos_done_bio(q->rq_qos, bio);
}
static inline void rq_qos_throttle(struct request_queue *q, struct bio *bio)
{
if (q->rq_qos)
__rq_qos_throttle(q->rq_qos, bio);
}
static inline void rq_qos_track(struct request_queue *q, struct request *rq,
struct bio *bio)
{
if (q->rq_qos)
__rq_qos_track(q->rq_qos, rq, bio);
}
void rq_qos_exit(struct request_queue *); void rq_qos_exit(struct request_queue *);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment