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>
allocate_section_policy = 1 Prioritize writing to section before allocate_section_hint
allocate_section_policy = 2 Prioritize writing to section after allocate_section_hint
=========================== ==========================================================
+
+What: /sys/fs/f2fs/<disk>/max_lock_elapsed_time
+Date: December 2025
+Contact: "Chao Yu" <chao@kernel.org>
+Description: 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.
get_lock_elapsed_time(&tts);
total_time = div_u64(tts.total_time - lc->ts.total_time, npm);
- if (total_time <= MAX_LOCK_ELAPSED_TIME)
+ if (total_time <= sem->sbi->max_lock_elapsed_time)
return;
#ifdef CONFIG_64BIT
/* carve out reserved_blocks from total blocks */
bool carve_out;
+ /* max elapsed time threshold in critical region that lock covered */
+ unsigned long long max_lock_elapsed_time;
+
#ifdef CONFIG_F2FS_FS_COMPRESSION
struct kmem_cache *page_array_slab; /* page array entry */
unsigned int page_array_slab_size; /* default page array slab size */
sbi->max_fragment_hole = DEF_FRAGMENT_SIZE;
spin_lock_init(&sbi->gc_remaining_trials_lock);
atomic64_set(&sbi->current_atomic_write, 0);
+ sbi->max_lock_elapsed_time = MAX_LOCK_ELAPSED_TIME;
sbi->dir_level = DEF_DIR_LEVEL;
sbi->interval_time[CP_TIME] = DEF_CP_INTERVAL;
F2FS_SBI_GENERAL_RW_ATTR(carve_out);
F2FS_SBI_GENERAL_RW_ATTR(reserved_pin_section);
F2FS_SBI_GENERAL_RW_ATTR(bggc_io_aware);
+F2FS_SBI_GENERAL_RW_ATTR(max_lock_elapsed_time);
/* STAT_INFO ATTR */
#ifdef CONFIG_F2FS_STAT_FS
ATTR_LIST(reserved_pin_section),
ATTR_LIST(allocate_section_hint),
ATTR_LIST(allocate_section_policy),
+ ATTR_LIST(max_lock_elapsed_time),
NULL,
};
ATTRIBUTE_GROUPS(f2fs);