ANDROID: vendor_hooks: Add hook for blk request

We want to use this hook to record time and blk size when blk request end

Bug: 292581151
Change-Id: I5083d24175725afd8e26c17a0a23c624432d2172
Signed-off-by: Li Chong <lichong1@oppo.com>
This commit is contained in:
Li Chong
2023-07-25 11:50:49 +08:00
committed by Treehugger Robot
parent bd148ab7d8
commit f9ac52c8b5
3 changed files with 9 additions and 0 deletions

View File

@@ -44,6 +44,8 @@
#define CREATE_TRACE_POINTS
#include <trace/events/block.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/block.h>
#include "blk.h"
#include "blk-mq.h"
@@ -1266,6 +1268,7 @@ void blk_account_io_done(struct request *req, u64 now)
* normal IO on queueing nor completion. Accounting the
* containing request is enough.
*/
trace_android_vh_blk_account_io_done(req);
if (req->part && blk_do_io_stat(req) &&
!(req->rq_flags & RQF_FLUSH_SEQ)) {
const int sgrp = op_stat_group(req_op(req));

View File

@@ -15,6 +15,7 @@
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_blk_alloc_rqs);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_blk_rq_ctx_init);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_blk_account_io_done);
/*
* For type visibility

View File

@@ -19,6 +19,7 @@
struct blk_mq_tags;
struct blk_mq_alloc_data;
struct blk_mq_tag_set;
struct request;
DECLARE_HOOK(android_vh_blk_alloc_rqs,
TP_PROTO(size_t *rq_size, struct blk_mq_tag_set *set,
@@ -30,6 +31,10 @@ DECLARE_HOOK(android_vh_blk_rq_ctx_init,
struct blk_mq_alloc_data *data, u64 alloc_time_ns),
TP_ARGS(rq, tags, data, alloc_time_ns));
DECLARE_HOOK(android_vh_blk_account_io_done,
TP_PROTO(struct request *rq),
TP_ARGS(rq));
#endif /* _TRACE_HOOK_BLOCK_H */
/* This part must be outside protection */