ANDROID: add hooks into blk-flush.c for customized I/O scheduler

android_vh_blk_alloc_flush_queue: Expand the flush request size to carry
more customized information

Bug: 319582497

Change-Id: I728852bd29ff7f851545c52fbdeafa7cd3a4addf
Signed-off-by: hao lv <hao.lv5@transsion.com>
This commit is contained in:
hao lv 2024-01-10 20:18:19 +08:00
parent d269992366
commit f76294a655
3 changed files with 15 additions and 2 deletions

View File

@ -467,11 +467,13 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask)
}
EXPORT_SYMBOL(blkdev_issue_flush);
#include <trace/hooks/block.h>
struct blk_flush_queue *blk_alloc_flush_queue(int node, int cmd_size,
gfp_t flags)
{
struct blk_flush_queue *fq;
int rq_sz = sizeof(struct request);
bool skip = false;
fq = kzalloc_node(sizeof(*fq), flags, node);
if (!fq)
@ -479,8 +481,12 @@ struct blk_flush_queue *blk_alloc_flush_queue(int node, int cmd_size,
spin_lock_init(&fq->mq_flush_lock);
trace_android_vh_blk_alloc_flush_queue(&skip, cmd_size, flags, node,
fq);
if (!skip) {
rq_sz = round_up(rq_sz + cmd_size, cache_line_size());
fq->flush_rq = kzalloc_node(rq_sz, flags, node);
}
if (!fq->flush_rq)
goto fail_rq;

View File

@ -531,6 +531,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_blk_mq_exit_queue);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_blk_mq_alloc_tag_set);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_blk_allocated_queue_init);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_blk_flush_plug_list);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_blk_alloc_flush_queue);
/*
* For type visibility
*/

View File

@ -27,6 +27,7 @@ struct bio;
struct request_queue;
struct request;
struct blk_plug;
struct blk_flush_queue;
DECLARE_HOOK(android_vh_blk_alloc_rqs,
TP_PROTO(size_t *rq_size, struct blk_mq_tag_set *set,
@ -107,6 +108,11 @@ DECLARE_RESTRICTED_HOOK(android_rvh_blk_flush_plug_list,
TP_PROTO(struct blk_plug *plug, bool from_schedule),
TP_ARGS(plug, from_schedule), 1);
DECLARE_HOOK(android_vh_blk_alloc_flush_queue,
TP_PROTO(bool *skip, int cmd_size, int flags, int node,
struct blk_flush_queue *fq),
TP_ARGS(skip, cmd_size, flags, node, fq));
#endif /* _TRACE_HOOK_BLOCK_H */
/* This part must be outside protection */