提交 8843e68d 编写于 作者: T Tejun Heo 提交者: Yang Yingliang

block/rq_qos: add rq_qos_merge()

mainline inclusion
from mainline-5.4-rc1
commit d3e65ffff61c329fb2d0bf15736c440c2d0cfc97
category: feature
bugzilla: 38688
CVE: NA

---------------------------

Add a merge hook for rq_qos.  This will be used by io.weight.
Signed-off-by: NTejun Heo <tj@kernel.org>
Signed-off-by: NJens Axboe <axboe@kernel.dk>

Conflict:
  block/blk-rq-qos.c
  block/blk-core.c
  block/blk-rq-qos.h
Signed-off-by: NYu Kuai <yukuai3@huawei.com>
Reviewed-by: NHou Tao <houtao1@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 449de6b8
......@@ -1802,6 +1802,7 @@ bool bio_attempt_back_merge(struct request_queue *q, struct request *req,
return false;
trace_block_bio_backmerge(q, req, bio);
rq_qos_merge(req->q, req, bio);
if ((req->cmd_flags & REQ_FAILFAST_MASK) != ff)
blk_rq_set_mixed_merge(req);
......@@ -1824,6 +1825,7 @@ bool bio_attempt_front_merge(struct request_queue *q, struct request *req,
return false;
trace_block_bio_frontmerge(q, req, bio);
rq_qos_merge(req->q, req, bio);
if ((req->cmd_flags & REQ_FAILFAST_MASK) != ff)
blk_rq_set_mixed_merge(req);
......@@ -1850,6 +1852,8 @@ bool bio_attempt_discard_merge(struct request_queue *q, struct request *req,
blk_rq_get_max_sectors(req, blk_rq_pos(req)))
goto no_merge;
rq_qos_merge(q, req, bio);
req->biotail->bi_next = bio;
req->biotail = bio;
req->__data_len += bio->bi_iter.bi_size;
......
......@@ -88,6 +88,17 @@ void rq_qos_track(struct request_queue *q, struct request *rq, struct bio *bio)
}
}
void rq_qos_merge(struct request_queue *q, struct request *rq, struct bio *bio)
{
struct rq_qos *rqos;
for (rqos = q->rq_qos; rqos; rqos = rqos->next) {
if (rqos->ops->merge)
rqos->ops->merge(rqos, rq, bio);
}
}
void rq_qos_done_bio(struct request_queue *q, struct bio *bio)
{
struct rq_qos *rqos;
......
......@@ -27,6 +27,7 @@ struct rq_qos {
struct rq_qos_ops {
void (*throttle)(struct rq_qos *, struct bio *, spinlock_t *);
void (*track)(struct rq_qos *, struct request *, struct bio *);
void (*merge)(struct rq_qos *, struct request *, struct bio *);
void (*issue)(struct rq_qos *, struct request *);
void (*requeue)(struct rq_qos *, struct request *);
void (*done)(struct rq_qos *, struct request *);
......@@ -102,5 +103,6 @@ void rq_qos_requeue(struct request_queue *, struct request *);
void rq_qos_done_bio(struct request_queue *q, struct bio *bio);
void rq_qos_throttle(struct request_queue *, struct bio *, spinlock_t *);
void rq_qos_track(struct request_queue *q, struct request *, struct bio *);
void rq_qos_merge(struct request_queue *q, struct request *rq, struct bio *bio);
void rq_qos_exit(struct request_queue *);
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册