From 06d2d8d2072717071054edabc0f4d8cbc8d1cbb1 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Sat, 29 Mar 2025 10:19:56 +0800 Subject: [PATCH] ANDROID: GKI: Add vendor hook define for f2fs create Files stored in UFS SLC have approximately 20% better random read performance compared to TLC. Storing some frequently and randomly accessed files in the SLC area can enhance user experience. Bug: 407795181 Change-Id: I571cb8b3821fb43dd4708c49c896e33e9942ab5e Signed-off-by: Rui Chen --- drivers/android/vendor_hooks.c | 1 + fs/f2fs/namei.c | 4 ++++ include/trace/hooks/fs.h | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 905e9d7e3305..1d580d39c52a 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -146,6 +146,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_f2fs_down_read); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_f2fs_improve_priority); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_f2fs_restore_priority); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_f2fs_printk); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_f2fs_create); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_io_statistics); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_attach); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_iommu_setup_dma_ops); diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 3d85d8116dae..48622fb0c4a1 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -22,6 +22,9 @@ #include "acl.h" #include +#undef CREATE_TRACE_POINTS +#include + static inline bool is_extension_exist(const unsigned char *s, const char *sub, bool tmp_ext, bool tmp_dot) { @@ -376,6 +379,7 @@ static int f2fs_create(struct mnt_idmap *idmap, struct inode *dir, inode->i_mapping->a_ops = &f2fs_dblock_aops; ino = inode->i_ino; + trace_android_vh_f2fs_create(inode, dentry); f2fs_lock_op(sbi); err = f2fs_add_link(dentry, inode); if (err) diff --git a/include/trace/hooks/fs.h b/include/trace/hooks/fs.h index f5498f044b4f..a313ee21339f 100644 --- a/include/trace/hooks/fs.h +++ b/include/trace/hooks/fs.h @@ -27,6 +27,10 @@ DECLARE_HOOK(android_vh_f2fs_printk, TP_PROTO(struct f2fs_sb_info *sbi, struct va_format *vaf, int level, bool limit_rate), TP_ARGS(sbi, vaf, level, limit_rate)); +DECLARE_HOOK(android_vh_f2fs_create, + TP_PROTO(struct inode *inode, struct dentry *dentry), + TP_ARGS(inode, dentry)); + DECLARE_HOOK(android_vh_wb_dirty_limits, TP_PROTO(unsigned long *thresh, struct bdi_writeback *wb), TP_ARGS(thresh, wb));