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
Bug: 415852476
Change-Id: I0665c4bdec945808860b73217cc0d128f49c2eb7
Signed-off-by: Wang Jianzheng <11134417@vivo.corp-partner.google.com>
(cherry picked from commit d2a7ba068de10173fffaa2a7288991429d44d031)
Signed-off-by: ying zuxin <11154159@vivo.com>
This commit is contained in:
Wang Jianzheng
2024-05-23 20:44:35 +08:00
committed by Todd Kjos
parent 034ca00e74
commit 205d32456b
3 changed files with 13 additions and 1 deletions

View File

@@ -517,6 +517,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_init_adjust_zone_wmark);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_lock_folio_drop_mmap_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_lock_folio_drop_mmap_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_update_page);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_f2fs_ra_op_flags);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_hibernated_do_mem_alloc);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_hibernate_save_cmp_len);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_percpu_rwsem_down_read);

View File

@@ -27,6 +27,7 @@
#include "segment.h"
#include "iostat.h"
#include <trace/events/f2fs.h>
#include <trace/hooks/blk.h>
#define NUM_PREALLOC_POST_READ_CTXS 128
@@ -2069,7 +2070,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

@@ -35,6 +35,13 @@ DECLARE_HOOK(android_vh_blk_mq_kick_requeue_list,
TP_PROTO(struct request_queue *q, unsigned long delay, bool *skip),
TP_ARGS(q, delay, skip));
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>