ANDROID: vendor_hooks: add hook in f2fs_file_open()

Add a hook to add OEM-specific flags to the inode, OEMs can utilize
these specific OEM flags to identify if a file is frequently used
and dynamically adjust the memory reclamation strategy during
memory reclaim.

Bug: 343628013
Bug: 413544055

Change-Id: I667e4de03e13822d25cb4e94a4ea065770e8f578
Signed-off-by: Yang Yang <yang.yang@vivo.com>
(cherry picked from commit 446570771ee30b592d83f57c3d132aa114c2b448)
Signed-off-by: ying zuxin <11154159@vivo.com>
This commit is contained in:
Yang Yang
2024-05-29 16:17:00 +08:00
committed by Treehugger Robot
parent abaea5446d
commit a31ea90fcb
3 changed files with 11 additions and 0 deletions
+1
View File
@@ -482,6 +482,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_stack_hash);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_check);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rmqueue);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_get_folio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_f2fs_file_open);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_compaction_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_compaction_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_vmscan_kswapd_wake);
+5
View File
@@ -35,6 +35,9 @@
#include <trace/events/f2fs.h>
#include <uapi/linux/f2fs.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/fs.h>
static vm_fault_t f2fs_filemap_fault(struct vm_fault *vmf)
{
struct inode *inode = file_inode(vmf->vma->vm_file);
@@ -605,6 +608,8 @@ static int f2fs_file_open(struct inode *inode, struct file *filp)
filp->f_mode |= FMODE_NOWAIT;
filp->f_mode |= FMODE_CAN_ODIRECT;
trace_android_vh_f2fs_file_open(inode, filp);
err = dquot_file_open(inode, filp);
if (err)
return err;
+5
View File
@@ -64,6 +64,11 @@ DECLARE_HOOK(android_vh_vfs_fsync_range,
DECLARE_RESTRICTED_HOOK(android_rvh_do_fcntl,
TP_PROTO(struct file *filp, unsigned int cmd, unsigned long arg, long *err),
TP_ARGS(filp, cmd, arg, err), 1);
DECLARE_HOOK(android_vh_f2fs_file_open,
TP_PROTO(struct inode *inode, struct file *filp),
TP_ARGS(inode, filp));
#endif /* _TRACE_HOOK_FS_H */
/* This part must be outside protection */