ANDROID: direct_io: Add a vendor hook to update OEM-specific field of struct bio

Based on the value of "dio->iocb->ki_ioprio" and "dio->iocb->ki_flags",
we can update OEM-specific field of struct bio through this hook. then
we can distinguish different IO's in lower level drivers and take different measures

Bug: 262939423
Change-Id: Ie84d737ca72c29737542f3783d27d7231a272cc4
Signed-off-by: lijiaming <lijiaming3@xiaomi.com>
This commit is contained in:
lijiaming
2022-12-17 14:32:48 +08:00
committed by Todd Kjos
parent 647d9c21bc
commit 0f1629ced8
3 changed files with 25 additions and 0 deletions

View File

@@ -107,6 +107,7 @@
#include <trace/hooks/cfg80211.h>
#include <trace/hooks/bl_hib.h>
#include <trace/hooks/dm.h>
#include <trace/hooks/direct_io.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
* associated with them) to allow external modules to probe them.
@@ -413,6 +414,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_skip_swap_map_write);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_post_image_save);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dm_update_clone_bio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_ctl_dirty_rate);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_direct_io_update_bio);
/*
* For type visibility
*/

View File

@@ -12,6 +12,7 @@
#include <linux/uio.h>
#include <linux/task_io_accounting_ops.h>
#include "trace.h"
#include <trace/hooks/direct_io.h>
#include "../internal.h"
@@ -323,6 +324,7 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter,
bio->bi_private = dio;
bio->bi_end_io = iomap_dio_bio_end_io;
bio->bi_opf = bio_opf;
trace_android_vh_direct_io_update_bio(dio->iocb, bio);
ret = bio_iov_iter_get_pages(bio, dio->submit.iter);
if (unlikely(ret)) {

View File

@@ -0,0 +1,21 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM direct_io
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_DIRECT_IO_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_DIRECT_IO_H
#include <trace/hooks/vendor_hooks.h>
struct kiocb;
struct bio;
DECLARE_HOOK(android_vh_direct_io_update_bio,
TP_PROTO(struct kiocb *iocb, struct bio *bio),
TP_ARGS(iocb, bio));
#endif /* _TRACE_HOOK_DIRECT_IO_H */
/* This part must be outside protection */
#include <trace/define_trace.h>