Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1393734
| From | Jaegeuk Kim <jaegeuk@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 07/11] f2fs: inject page allocation failures |
| Date | 2016-05-03 20:30 +0200 |
| Message-ID | <ruNf5-4Gi-51@gated-at.bofh.it> (permalink) |
| References | <ruNf3-4Gi-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This patch adds page allocation failures.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/f2fs.h | 9 +++++++++
fs/f2fs/super.c | 1 +
2 files changed, 10 insertions(+)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 60098df..02c2c96 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -40,6 +40,7 @@
#ifdef CONFIG_F2FS_FAULT_INJECTION
enum {
FAULT_KMALLOC,
+ FAULT_PAGE_ALLOC,
FAULT_MAX,
};
@@ -1296,6 +1297,14 @@ static inline unsigned int valid_inode_count(struct f2fs_sb_info *sbi)
static inline struct page *f2fs_grab_cache_page(struct address_space *mapping,
pgoff_t index, bool for_write)
{
+#ifdef CONFIG_F2FS_FAULT_INJECTION
+ struct page *page = find_lock_page(mapping, index);
+ if (page)
+ return page;
+
+ if (time_to_inject(FAULT_PAGE_ALLOC))
+ return NULL;
+#endif
if (!for_write)
return grab_cache_page(mapping, index);
return grab_cache_page_write_begin(mapping, index, AOP_FLAG_NOFS);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 76f4d2c..1715794 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -45,6 +45,7 @@ atomic_t f2fs_ops;
char *fault_name[FAULT_MAX] = {
[FAULT_KMALLOC] = "kmalloc",
+ [FAULT_PAGE_ALLOC] = "page alloc",
};
#endif
--
2.6.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 01/11] f2fs: introduce macros for proc entries Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-03 20:30 +0200
[PATCH 04/11] f2fs: use f2fs_grab_cache_page instead of grab_cache_page Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-03 20:30 +0200
[PATCH 10/11] f2fs: fix leak of orphan inode objects Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-03 20:30 +0200
[PATCH 07/11] f2fs: inject page allocation failures Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-03 20:30 +0200
[PATCH 09/11] f2fs: revisit error handling flows Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-03 20:30 +0200
[PATCH 11/11] f2fs: retry to truncate blocks in -ENOMEM case Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-03 20:30 +0200
Re: [f2fs-dev] [PATCH 11/11] f2fs: retry to truncate blocks in -ENOMEM case Hou Pengyang <houpengyang@huawei.com> - 2016-05-05 04:10 +0200
Re: [f2fs-dev] [PATCH 11/11] f2fs: retry to truncate blocks in -ENOMEM case Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-05 05:00 +0200
csiph-web