diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-04-29 19:17:09 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-05-07 13:32:23 -0400 |
commit | c41f3cc3ae34acdbcec328084b4b74f686c02f0d (patch) | |
tree | 4012769ef67e049cdc38fef890f7c67881506457 /fs/f2fs/f2fs.h | |
parent | 2c63fead9e372b3b65d1883bb174df6c9820f1dd (diff) |
f2fs: inject page allocation failures
This patch adds page allocation failures.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r-- | fs/f2fs/f2fs.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index cf03c57d0feb..d550a95d30f1 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #ifdef CONFIG_F2FS_FAULT_INJECTION | 40 | #ifdef CONFIG_F2FS_FAULT_INJECTION |
41 | enum { | 41 | enum { |
42 | FAULT_KMALLOC, | 42 | FAULT_KMALLOC, |
43 | FAULT_PAGE_ALLOC, | ||
43 | FAULT_MAX, | 44 | FAULT_MAX, |
44 | }; | 45 | }; |
45 | 46 | ||
@@ -1296,6 +1297,14 @@ static inline unsigned int valid_inode_count(struct f2fs_sb_info *sbi) | |||
1296 | static inline struct page *f2fs_grab_cache_page(struct address_space *mapping, | 1297 | static inline struct page *f2fs_grab_cache_page(struct address_space *mapping, |
1297 | pgoff_t index, bool for_write) | 1298 | pgoff_t index, bool for_write) |
1298 | { | 1299 | { |
1300 | #ifdef CONFIG_F2FS_FAULT_INJECTION | ||
1301 | struct page *page = find_lock_page(mapping, index); | ||
1302 | if (page) | ||
1303 | return page; | ||
1304 | |||
1305 | if (time_to_inject(FAULT_PAGE_ALLOC)) | ||
1306 | return NULL; | ||
1307 | #endif | ||
1299 | if (!for_write) | 1308 | if (!for_write) |
1300 | return grab_cache_page(mapping, index); | 1309 | return grab_cache_page(mapping, index); |
1301 | return grab_cache_page_write_begin(mapping, index, AOP_FLAG_NOFS); | 1310 | return grab_cache_page_write_begin(mapping, index, AOP_FLAG_NOFS); |