提交 9a003b73 编写于 作者: L Li Nan 提交者: Zheng Zengkai

blk-mq: fix kabi broken in struct request

hulk inclusion
category: bugfix
bugzilla: 187921, https://gitee.com/openeuler/kernel/issues/I66VDB
CVE: NA

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

Enable CONFIG_BLK_RQ_ALLOC_TIME will cause kabi broken, use request
wrapper to fix it.
Signed-off-by: NLi Nan <linan122@huawei.com>
Reviewed-by: NHou Tao <houtao1@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 f5b0c4d9
......@@ -2747,8 +2747,13 @@ static void ioc_rqos_done(struct rq_qos *rqos, struct request *rq)
struct ioc_pcpu_stat *ccs;
u64 on_q_ns, rq_wait_ns, size_nsec;
int pidx, rw;
struct request_wrapper *rq_wrapper;
if (!ioc->enabled || !rq->alloc_time_ns || !rq->start_time_ns)
if (WARN_ON_ONCE(!(rq->rq_flags & RQF_FROM_BLOCK)))
return;
rq_wrapper = request_to_wrapper(rq);
if (!ioc->enabled || !rq_wrapper->alloc_time_ns || !rq->start_time_ns)
return;
switch (req_op(rq) & REQ_OP_MASK) {
......@@ -2764,8 +2769,8 @@ static void ioc_rqos_done(struct rq_qos *rqos, struct request *rq)
return;
}
on_q_ns = ktime_get_ns() - rq->alloc_time_ns;
rq_wait_ns = rq->start_time_ns - rq->alloc_time_ns;
on_q_ns = ktime_get_ns() - rq_wrapper->alloc_time_ns;
rq_wait_ns = rq->start_time_ns - rq_wrapper->alloc_time_ns;
size_nsec = div64_u64(calc_size_vtime_cost(rq, ioc), VTIME_PER_NSEC);
ccs = get_cpu_ptr(ioc->pcpu_stat);
......
......@@ -386,7 +386,7 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
rq->rq_disk = NULL;
rq->part = NULL;
#ifdef CONFIG_BLK_RQ_ALLOC_TIME
rq->alloc_time_ns = alloc_time_ns;
request_to_wrapper(rq)->alloc_time_ns = alloc_time_ns;
#endif
request_to_wrapper(rq)->stat_time_ns = 0;
if (blk_mq_need_time_stamp(rq))
......
......@@ -40,6 +40,10 @@ struct blk_mq_ctx {
struct request_wrapper {
/* Time that I/O was counted in part_get_stat_info(). */
u64 stat_time_ns;
#ifdef CONFIG_BLK_RQ_ALLOC_TIME
/* Time that the first bio started allocating this request. */
u64 alloc_time_ns;
#endif
} ____cacheline_aligned;
static inline struct request_wrapper *request_to_wrapper(void *rq)
......
......@@ -202,10 +202,6 @@ struct request {
struct gendisk *rq_disk;
struct hd_struct *part;
#ifdef CONFIG_BLK_RQ_ALLOC_TIME
/* Time that the first bio started allocating this request. */
u64 alloc_time_ns;
#endif
/* Time that this request was allocated for this IO. */
u64 start_time_ns;
/* Time that I/O was submitted to the device. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册