diff options
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/checkpoint.c | 1 | ||||
-rw-r--r-- | fs/f2fs/data.c | 4 | ||||
-rw-r--r-- | fs/f2fs/dir.c | 4 | ||||
-rw-r--r-- | fs/f2fs/f2fs.h | 20 | ||||
-rw-r--r-- | fs/f2fs/gc.c | 4 | ||||
-rw-r--r-- | fs/f2fs/inode.c | 4 | ||||
-rw-r--r-- | fs/f2fs/node.c | 4 | ||||
-rw-r--r-- | fs/f2fs/segment.c | 4 |
8 files changed, 32 insertions, 13 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index cd7132121573..04d7c244c0f0 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c | |||
@@ -494,6 +494,7 @@ int acquire_orphan_inode(struct f2fs_sb_info *sbi) | |||
494 | #ifdef CONFIG_F2FS_FAULT_INJECTION | 494 | #ifdef CONFIG_F2FS_FAULT_INJECTION |
495 | if (time_to_inject(sbi, FAULT_ORPHAN)) { | 495 | if (time_to_inject(sbi, FAULT_ORPHAN)) { |
496 | spin_unlock(&im->ino_lock); | 496 | spin_unlock(&im->ino_lock); |
497 | f2fs_show_injection_info(FAULT_ORPHAN); | ||
497 | return -ENOSPC; | 498 | return -ENOSPC; |
498 | } | 499 | } |
499 | #endif | 500 | #endif |
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 9e51c5e40ce1..b0a2e3faabb2 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
@@ -55,8 +55,10 @@ static void f2fs_read_end_io(struct bio *bio) | |||
55 | int i; | 55 | int i; |
56 | 56 | ||
57 | #ifdef CONFIG_F2FS_FAULT_INJECTION | 57 | #ifdef CONFIG_F2FS_FAULT_INJECTION |
58 | if (time_to_inject(F2FS_P_SB(bio->bi_io_vec->bv_page), FAULT_IO)) | 58 | if (time_to_inject(F2FS_P_SB(bio->bi_io_vec->bv_page), FAULT_IO)) { |
59 | f2fs_show_injection_info(FAULT_IO); | ||
59 | bio->bi_error = -EIO; | 60 | bio->bi_error = -EIO; |
61 | } | ||
60 | #endif | 62 | #endif |
61 | 63 | ||
62 | if (f2fs_bio_encrypted(bio)) { | 64 | if (f2fs_bio_encrypted(bio)) { |
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 54aa30ee028f..295a223ae11e 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c | |||
@@ -549,8 +549,10 @@ int f2fs_add_regular_entry(struct inode *dir, const struct qstr *new_name, | |||
549 | 549 | ||
550 | start: | 550 | start: |
551 | #ifdef CONFIG_F2FS_FAULT_INJECTION | 551 | #ifdef CONFIG_F2FS_FAULT_INJECTION |
552 | if (time_to_inject(F2FS_I_SB(dir), FAULT_DIR_DEPTH)) | 552 | if (time_to_inject(F2FS_I_SB(dir), FAULT_DIR_DEPTH)) { |
553 | f2fs_show_injection_info(FAULT_DIR_DEPTH); | ||
553 | return -ENOSPC; | 554 | return -ENOSPC; |
555 | } | ||
554 | #endif | 556 | #endif |
555 | if (unlikely(current_depth == MAX_DIR_HASH_DEPTH)) | 557 | if (unlikely(current_depth == MAX_DIR_HASH_DEPTH)) |
556 | return -ENOSPC; | 558 | return -ENOSPC; |
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)) | ||
955 | static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type) | 959 | static 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 | } |
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 6c996e39b59a..8be5144da8e6 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c | |||
@@ -48,8 +48,10 @@ static int gc_thread_func(void *data) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | #ifdef CONFIG_F2FS_FAULT_INJECTION | 50 | #ifdef CONFIG_F2FS_FAULT_INJECTION |
51 | if (time_to_inject(sbi, FAULT_CHECKPOINT)) | 51 | if (time_to_inject(sbi, FAULT_CHECKPOINT)) { |
52 | f2fs_show_injection_info(FAULT_CHECKPOINT); | ||
52 | f2fs_stop_checkpoint(sbi, false); | 53 | f2fs_stop_checkpoint(sbi, false); |
54 | } | ||
53 | #endif | 55 | #endif |
54 | 56 | ||
55 | /* | 57 | /* |
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index af06bda51a54..24bb8213d974 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c | |||
@@ -373,8 +373,10 @@ void f2fs_evict_inode(struct inode *inode) | |||
373 | goto no_delete; | 373 | goto no_delete; |
374 | 374 | ||
375 | #ifdef CONFIG_F2FS_FAULT_INJECTION | 375 | #ifdef CONFIG_F2FS_FAULT_INJECTION |
376 | if (time_to_inject(sbi, FAULT_EVICT_INODE)) | 376 | if (time_to_inject(sbi, FAULT_EVICT_INODE)) { |
377 | f2fs_show_injection_info(FAULT_EVICT_INODE); | ||
377 | goto no_delete; | 378 | goto no_delete; |
379 | } | ||
378 | #endif | 380 | #endif |
379 | 381 | ||
380 | remove_ino_entry(sbi, inode->i_ino, APPEND_INO); | 382 | remove_ino_entry(sbi, inode->i_ino, APPEND_INO); |
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 43d35ec11851..24ea49f98891 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c | |||
@@ -1987,8 +1987,10 @@ bool alloc_nid(struct f2fs_sb_info *sbi, nid_t *nid) | |||
1987 | struct free_nid *i = NULL; | 1987 | struct free_nid *i = NULL; |
1988 | retry: | 1988 | retry: |
1989 | #ifdef CONFIG_F2FS_FAULT_INJECTION | 1989 | #ifdef CONFIG_F2FS_FAULT_INJECTION |
1990 | if (time_to_inject(sbi, FAULT_ALLOC_NID)) | 1990 | if (time_to_inject(sbi, FAULT_ALLOC_NID)) { |
1991 | f2fs_show_injection_info(FAULT_ALLOC_NID); | ||
1991 | return false; | 1992 | return false; |
1993 | } | ||
1992 | #endif | 1994 | #endif |
1993 | spin_lock(&nm_i->nid_list_lock); | 1995 | spin_lock(&nm_i->nid_list_lock); |
1994 | 1996 | ||
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 9eb6d89bf9e2..1bab09097590 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -352,8 +352,10 @@ int commit_inmem_pages(struct inode *inode) | |||
352 | void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need) | 352 | void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need) |
353 | { | 353 | { |
354 | #ifdef CONFIG_F2FS_FAULT_INJECTION | 354 | #ifdef CONFIG_F2FS_FAULT_INJECTION |
355 | if (time_to_inject(sbi, FAULT_CHECKPOINT)) | 355 | if (time_to_inject(sbi, FAULT_CHECKPOINT)) { |
356 | f2fs_show_injection_info(FAULT_CHECKPOINT); | ||
356 | f2fs_stop_checkpoint(sbi, false); | 357 | f2fs_stop_checkpoint(sbi, false); |
358 | } | ||
357 | #endif | 359 | #endif |
358 | 360 | ||
359 | if (!need) | 361 | if (!need) |