Skip to content

Commit c56254e

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: introduce FAULT_LOCK_TIMEOUT
This patch introduce a new fault type FAULT_LOCK_TIMEOUT, it can be used to inject timeout into lock duration. Timeout type can be set via /sys/fs/f2fs/<disk>/inject_timeout_type Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 7a127c8 commit c56254e

5 files changed

Lines changed: 7 additions & 0 deletions

File tree

Documentation/ABI/testing/sysfs-fs-f2fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ Description: Support configuring fault injection type, should be
743743
FAULT_INCONSISTENT_FOOTER 0x00200000
744744
FAULT_ATOMIC_TIMEOUT 0x00400000 (1000ms)
745745
FAULT_VMALLOC 0x00800000
746+
FAULT_LOCK_TIMEOUT 0x01000000 (1000ms)
746747
=========================== ==========
747748

748749
What: /sys/fs/f2fs/<disk>/discard_io_aware_gran

Documentation/filesystems/f2fs.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ fault_type=%d Support configuring fault injection type, should be
217217
FAULT_INCONSISTENT_FOOTER 0x00200000
218218
FAULT_ATOMIC_TIMEOUT 0x00400000 (1000ms)
219219
FAULT_VMALLOC 0x00800000
220+
FAULT_LOCK_TIMEOUT 0x01000000 (1000ms)
220221
=========================== ==========
221222
mode=%s Control block allocation mode which supports "adaptive"
222223
and "lfs". In "lfs" mode, there should be no random

fs/f2fs/checkpoint.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ static inline void trace_lock_elapsed_time_end(struct f2fs_rwsem *sem,
6363
if (!lc->lock_trace)
6464
return;
6565

66+
if (time_to_inject(sem->sbi, FAULT_LOCK_TIMEOUT))
67+
f2fs_io_schedule_timeout_killable(DEFAULT_FAULT_TIMEOUT);
68+
6669
get_lock_elapsed_time(&tts);
6770

6871
total_time = div_u64(tts.total_time - lc->ts.total_time, npm);

fs/f2fs/f2fs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ enum {
6565
FAULT_INCONSISTENT_FOOTER,
6666
FAULT_ATOMIC_TIMEOUT,
6767
FAULT_VMALLOC,
68+
FAULT_LOCK_TIMEOUT,
6869
FAULT_MAX,
6970
};
7071

fs/f2fs/super.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const char *f2fs_fault_name[FAULT_MAX] = {
6969
[FAULT_INCONSISTENT_FOOTER] = "inconsistent footer",
7070
[FAULT_ATOMIC_TIMEOUT] = "atomic timeout",
7171
[FAULT_VMALLOC] = "vmalloc",
72+
[FAULT_LOCK_TIMEOUT] = "lock timeout",
7273
};
7374

7475
int f2fs_build_fault_attr(struct f2fs_sb_info *sbi, unsigned long rate,

0 commit comments

Comments
 (0)