Re: [PATCH v2] f2fs: merge f2fs_show_injection_info() into time_to_inject()

From: Chao Yu
Date: Tue Dec 20 2022 - 02:25:04 EST


On 2022/12/19 21:25, Yangtao Li wrote:
There is no need to additionally use f2fs_show_injection_info()
to output information. Concatenate time_to_inject() and
__time_to_inject() via a macro. In the new __time_to_inject()
function, pass in the caller function name. And in order to avoid
this inline function is not expanded causing __builtin_return_address(0)
return address of of time_to_inject(), mark time_to_inject() as
__always_inline.

IMO, we'd better have a good reason (maybe performace related) to change
inline to __always_inline, rather than avoiding printed message change
due to compile option.

-static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type)
+#define time_to_inject(sbi, type) __time_to_inject(sbi, type, __func__)
+static __always_inline bool __time_to_inject(struct f2fs_sb_info *sbi, int type,
+ const char *func_name)

How about:

#define time_to_inject(sbi, type) __time_to_inject(sbi, type, __func__, \
__builtin_return_address(0))
static inline bool __time_to_inject(struct f2fs_sb_info *sbi, int type,
const char *func, const char *parent_func)

Thanks,