ANDROID: vendor_hooks: add vendor hooks for readahead bio

Different scenarios may require different readahead parameters and readahead mechanisms, such as application start-up or game loading. Add vendor hook to f2fs_read_single_page, so we can modify some bio flags according to the struct readahead_control.

Bug: 342340767

Change-Id: I0665c4bdec945808860b73217cc0d128f49c2eb7
Signed-off-by: Wang Jianzheng <11134417@vivo.corp-partner.google.com>
This commit is contained in:
Wang Jianzheng 2024-05-23 20:44:35 +08:00 committed by Akilesh Kailash
parent 57bfc45d46
commit d2a7ba068d
3 changed files with 13 additions and 1 deletions

View File

@ -427,6 +427,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_usb_dev_resume);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_bd_link_disk_holder);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_new_mount_fc);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_blk_fill_rwbs);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_f2fs_ra_op_flags);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_use_amu_fie);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_end);

View File

@ -28,6 +28,7 @@
#include "segment.h"
#include "iostat.h"
#include <trace/events/f2fs.h>
#include <trace/hooks/blk.h>
#define NUM_PREALLOC_POST_READ_CTXS 128
@ -2074,7 +2075,10 @@ static inline loff_t f2fs_readpage_limit(struct inode *inode)
static inline blk_opf_t f2fs_ra_op_flags(struct readahead_control *rac)
{
return rac ? REQ_RAHEAD : 0;
blk_opf_t op_flag = rac ? REQ_RAHEAD : 0;
trace_android_vh_f2fs_ra_op_flags(&op_flag, rac);
return op_flag;
}
static int f2fs_read_single_page(struct inode *inode, struct folio *folio,

View File

@ -27,6 +27,13 @@ DECLARE_HOOK(android_vh_do_new_mount_fc,
TP_PROTO(struct path *mountpoint, struct vfsmount *mnt),
TP_ARGS(mountpoint, mnt));
struct readahead_control;
typedef __u32 __bitwise blk_opf_t;
DECLARE_HOOK(android_vh_f2fs_ra_op_flags,
TP_PROTO(blk_opf_t *op_flag, struct readahead_control *rac),
TP_ARGS(op_flag, rac));
#endif /* _TRACE_HOOK_BLK_H */
/* This part must be outside protection */
#include <trace/define_trace.h>