ANDROID: vendor_hooks: add hooks for f2fs_printk

Add vendor hooks in f2fs_printk so that the application
can also capture and handle f2fs error messages. When
the application captures f2fs error messages, it can
report these errors and provide some prompts or restart
the application.

Bug: 395976123
Change-Id: I47d082a6dad2461119f7f14cdabfa7dcf208fe5e
Signed-off-by: Rui Chen <chenrui9@honor.com>
This commit is contained in:
Rui Chen
2025-02-10 18:01:37 +08:00
committed by Sandeep Dhavale
parent a811d08217
commit 3444d6a933
3 changed files with 11 additions and 1 deletions
+1
View File
@@ -134,6 +134,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_transfer_rsp_status);
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_io_statistics);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_attach);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_iommu_setup_dma_ops);
+4 -1
View File
@@ -39,6 +39,9 @@
#define CREATE_TRACE_POINTS
#include <trace/events/f2fs.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/fs.h>
static struct kmem_cache *f2fs_inode_cachep;
#ifdef CONFIG_F2FS_FAULT_INJECTION
@@ -291,7 +294,7 @@ void f2fs_printk(struct f2fs_sb_info *sbi, bool limit_rate,
else
printk("%c%cF2FS-fs (%s): %pV\n",
KERN_SOH_ASCII, level, sbi->sb->s_id, &vaf);
trace_android_vh_f2fs_printk(sbi, &vaf, level, limit_rate);
va_end(args);
}
+6
View File
@@ -8,6 +8,8 @@
#define _TRACE_HOOK_FS_H
#include <trace/hooks/vendor_hooks.h>
struct f2fs_sb_info;
struct va_format;
DECLARE_RESTRICTED_HOOK(android_rvh_f2fs_down_read,
TP_PROTO(wait_queue_head_t *read_waiters, struct rw_semaphore *rwsem, bool *skip),
@@ -21,6 +23,10 @@ DECLARE_HOOK(android_vh_f2fs_restore_priority,
TP_PROTO(struct task_struct *p, int saved_prio),
TP_ARGS(p, saved_prio));
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));
#endif /* _TRACE_HOOK_FS_H */
/* This part must be outside protection */