Skip to content

Commit e4b7562

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: sysfs: introduce max_lock_elapsed_time
This patch add a new sysfs node in /sys/fs/f2fs/<device>/max_lock_elapsed_time. This is a threshold, once a thread enters critical region that lock covers, total elapsed time exceeds this threshold, f2fs will print tracepoint to dump information of related context. This sysfs entry can be used to control the value of threshold, by default, the value is 500 ms. Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 79b3ceb commit e4b7562

5 files changed

Lines changed: 15 additions & 1 deletion

File tree

Documentation/ABI/testing/sysfs-fs-f2fs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,3 +939,11 @@ Description: Controls write priority in multi-devices setups. A value of 0 means
939939
allocate_section_policy = 1 Prioritize writing to section before allocate_section_hint
940940
allocate_section_policy = 2 Prioritize writing to section after allocate_section_hint
941941
=========================== ==========================================================
942+
943+
What: /sys/fs/f2fs/<disk>/max_lock_elapsed_time
944+
Date: December 2025
945+
Contact: "Chao Yu" <chao@kernel.org>
946+
Description: This is a threshold, once a thread enters critical region that lock covers, total
947+
elapsed time exceeds this threshold, f2fs will print tracepoint to dump information
948+
of related context. This sysfs entry can be used to control the value of threshold,
949+
by default, the value is 500 ms.

fs/f2fs/checkpoint.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static inline void trace_lock_elapsed_time_end(struct f2fs_rwsem *sem,
6666
get_lock_elapsed_time(&tts);
6767

6868
total_time = div_u64(tts.total_time - lc->ts.total_time, npm);
69-
if (total_time <= MAX_LOCK_ELAPSED_TIME)
69+
if (total_time <= sem->sbi->max_lock_elapsed_time)
7070
return;
7171

7272
#ifdef CONFIG_64BIT

fs/f2fs/f2fs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,6 +1951,9 @@ struct f2fs_sb_info {
19511951
/* carve out reserved_blocks from total blocks */
19521952
bool carve_out;
19531953

1954+
/* max elapsed time threshold in critical region that lock covered */
1955+
unsigned long long max_lock_elapsed_time;
1956+
19541957
#ifdef CONFIG_F2FS_FS_COMPRESSION
19551958
struct kmem_cache *page_array_slab; /* page array entry */
19561959
unsigned int page_array_slab_size; /* default page array slab size */

fs/f2fs/super.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4295,6 +4295,7 @@ static void init_sb_info(struct f2fs_sb_info *sbi)
42954295
sbi->max_fragment_hole = DEF_FRAGMENT_SIZE;
42964296
spin_lock_init(&sbi->gc_remaining_trials_lock);
42974297
atomic64_set(&sbi->current_atomic_write, 0);
4298+
sbi->max_lock_elapsed_time = MAX_LOCK_ELAPSED_TIME;
42984299

42994300
sbi->dir_level = DEF_DIR_LEVEL;
43004301
sbi->interval_time[CP_TIME] = DEF_CP_INTERVAL;

fs/f2fs/sysfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,6 +1219,7 @@ F2FS_SBI_GENERAL_RW_ATTR(blkzone_alloc_policy);
12191219
F2FS_SBI_GENERAL_RW_ATTR(carve_out);
12201220
F2FS_SBI_GENERAL_RW_ATTR(reserved_pin_section);
12211221
F2FS_SBI_GENERAL_RW_ATTR(bggc_io_aware);
1222+
F2FS_SBI_GENERAL_RW_ATTR(max_lock_elapsed_time);
12221223

12231224
/* STAT_INFO ATTR */
12241225
#ifdef CONFIG_F2FS_STAT_FS
@@ -1422,6 +1423,7 @@ static struct attribute *f2fs_attrs[] = {
14221423
ATTR_LIST(reserved_pin_section),
14231424
ATTR_LIST(allocate_section_hint),
14241425
ATTR_LIST(allocate_section_policy),
1426+
ATTR_LIST(max_lock_elapsed_time),
14251427
NULL,
14261428
};
14271429
ATTRIBUTE_GROUPS(f2fs);

0 commit comments

Comments
 (0)