summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/f2fs.h
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2017-02-24 22:08:28 -0500
committerJaegeuk Kim <jaegeuk@kernel.org>2017-02-27 12:59:55 -0500
commit55523519bc7227e651fd4febeb3aafdd22b8af1c (patch)
tree967a79ab5559dc46d191812ef50aa5a8d144ec78 /fs/f2fs/f2fs.h
parentdd7b2333e6cd31584682382fcf0a1c1e5140b936 (diff)
f2fs: show simple call stack in fault injection message
Previously kernel message can show that in which function we do the injection, but unfortunately, most of the caller are the same, for tracking more information of injection path, it needs to show upper caller's name. This patch supports that ability. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r--fs/f2fs/f2fs.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index d1156cdd211e..8c0916ae0bea 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -952,6 +952,10 @@ struct f2fs_sb_info {
952}; 952};
953 953
954#ifdef CONFIG_F2FS_FAULT_INJECTION 954#ifdef CONFIG_F2FS_FAULT_INJECTION
955#define f2fs_show_injection_info(type) \
956 printk("%sF2FS-fs : inject %s in %s of %pF\n", \
957 KERN_INFO, fault_name[type], \
958 __func__, __builtin_return_address(0))
955static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type) 959static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type)
956{ 960{
957 struct f2fs_fault_info *ffi = &sbi->fault_info; 961 struct f2fs_fault_info *ffi = &sbi->fault_info;
@@ -965,10 +969,6 @@ static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type)
965 atomic_inc(&ffi->inject_ops); 969 atomic_inc(&ffi->inject_ops);
966 if (atomic_read(&ffi->inject_ops) >= ffi->inject_rate) { 970 if (atomic_read(&ffi->inject_ops) >= ffi->inject_rate) {
967 atomic_set(&ffi->inject_ops, 0); 971 atomic_set(&ffi->inject_ops, 0);
968 printk("%sF2FS-fs : inject %s in %pF\n",
969 KERN_INFO,
970 fault_name[type],
971 __builtin_return_address(0));
972 return true; 972 return true;
973 } 973 }
974 return false; 974 return false;
@@ -1277,8 +1277,10 @@ static inline bool inc_valid_block_count(struct f2fs_sb_info *sbi,
1277 blkcnt_t diff; 1277 blkcnt_t diff;
1278 1278
1279#ifdef CONFIG_F2FS_FAULT_INJECTION 1279#ifdef CONFIG_F2FS_FAULT_INJECTION
1280 if (time_to_inject(sbi, FAULT_BLOCK)) 1280 if (time_to_inject(sbi, FAULT_BLOCK)) {
1281 f2fs_show_injection_info(FAULT_BLOCK);
1281 return false; 1282 return false;
1283 }
1282#endif 1284#endif
1283 /* 1285 /*
1284 * let's increase this in prior to actual block count change in order 1286 * let's increase this in prior to actual block count change in order
@@ -1518,8 +1520,10 @@ static inline struct page *f2fs_grab_cache_page(struct address_space *mapping,
1518 if (page) 1520 if (page)
1519 return page; 1521 return page;
1520 1522
1521 if (time_to_inject(F2FS_M_SB(mapping), FAULT_PAGE_ALLOC)) 1523 if (time_to_inject(F2FS_M_SB(mapping), FAULT_PAGE_ALLOC)) {
1524 f2fs_show_injection_info(FAULT_PAGE_ALLOC);
1522 return NULL; 1525 return NULL;
1526 }
1523#endif 1527#endif
1524 if (!for_write) 1528 if (!for_write)
1525 return grab_cache_page(mapping, index); 1529 return grab_cache_page(mapping, index);
@@ -1995,8 +1999,10 @@ static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi,
1995 size_t size, gfp_t flags) 1999 size_t size, gfp_t flags)
1996{ 2000{
1997#ifdef CONFIG_F2FS_FAULT_INJECTION 2001#ifdef CONFIG_F2FS_FAULT_INJECTION
1998 if (time_to_inject(sbi, FAULT_KMALLOC)) 2002 if (time_to_inject(sbi, FAULT_KMALLOC)) {
2003 f2fs_show_injection_info(FAULT_KMALLOC);
1999 return NULL; 2004 return NULL;
2005 }
2000#endif 2006#endif
2001 return kmalloc(size, flags); 2007 return kmalloc(size, flags);
2002} 2008}