summaryrefslogtreecommitdiff
path: root/fs/f2fs/f2fs.h
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2016-04-30 02:29:22 +0300
committerJaegeuk Kim <jaegeuk@kernel.org>2016-05-07 20:32:24 +0300
commitcb78942b821380913e6810375c9ce72858e64c4f (patch)
tree1106e5e49216f247f4c373192c71a382b9065fe0 /fs/f2fs/f2fs.h
parentc41f3cc3ae34acdbcec328084b4b74f686c02f0d (diff)
downloadlinux-cb78942b821380913e6810375c9ce72858e64c4f.tar.xz
f2fs: inject ENOSPC failures
This patch injects ENOSPC failures. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r--fs/f2fs/f2fs.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index d550a95d30f1..8ba2f923d95a 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -41,6 +41,10 @@
enum {
FAULT_KMALLOC,
FAULT_PAGE_ALLOC,
+ FAULT_ALLOC_NID,
+ FAULT_ORPHAN,
+ FAULT_BLOCK,
+ FAULT_DIR_DEPTH,
FAULT_MAX,
};
@@ -1087,6 +1091,12 @@ static inline bool inc_valid_block_count(struct f2fs_sb_info *sbi,
block_t valid_block_count;
spin_lock(&sbi->stat_lock);
+#ifdef CONFIG_F2FS_FAULT_INJECTION
+ if (time_to_inject(FAULT_BLOCK)) {
+ spin_unlock(&sbi->stat_lock);
+ return false;
+ }
+#endif
valid_block_count =
sbi->total_valid_block_count + (block_t)count;
if (unlikely(valid_block_count > sbi->user_block_count)) {