lkml.org 
[lkml]   [2022]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] f2fs: merge f2fs_show_injection_info() into time_to_inject()
Date
> After moving f2fs_show_injection_info() core functionality into time_to_inject(),
> __builtin_return_address(0) result changes from return address of caller of
> f2fs_show_injection_info() to return address of time_to_inject().

I tried the __builtin_return_address(1) parameter just now, and no error
was reported when compiling, but a null pointer problem will be triggered
when the kernel is running.

I thought about it, and the print address didn't seem clear enough.
Let's just print the line number of the caller?

#define time_to_inject(sbi, type) __time_to_inject(sbi, type, __func__, __LINE__)
static inline bool __time_to_inject(struct f2fs_sb_info *sbi, int type,
const char *func_name, unsigned int line)
{
struct f2fs_fault_info *ffi = &F2FS_OPTION(sbi).fault_info;

if (!ffi->inject_rate)
return false;

if (!IS_FAULT_SET(ffi, type))
return false;

atomic_inc(&ffi->inject_ops);
if (atomic_read(&ffi->inject_ops) >= ffi->inject_rate) {
atomic_set(&ffi->inject_ops, 0);
printk_ratelimited("%sF2FS-fs (%s) : inject %s in [%s] %d\n",
KERN_INFO, sbi->sb->s_id, f2fs_fault_name[type],
func_name, line);
return true;
}
return false;
}

Thx,
Yangtao

\
 
 \ /
  Last update: 2022-12-16 04:49    [W:0.058 / U:1.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site