summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChao Yu <chao@kernel.org>2026-01-04 10:07:23 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2026-01-07 03:17:07 +0000
commit67972c2b89749356bc9823bd58f7f14b28e681e4 (patch)
treea132ad333cf87c512763e37a8211996f896a134c
parentce9fe67c9cdb21a0321f8ea37b725b3258d2b3cd (diff)
f2fs: trace elapsed time for io_rwsem lock
Use f2fs_{down,up}_{read,write}_trace for io_rwsem to trace lock elapsed time. Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/data.c18
-rw-r--r--fs/f2fs/f2fs.h1
-rw-r--r--include/trace/events/f2fs.h3
3 files changed, 14 insertions, 8 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 79455d7acba5..7dee58fbfc0b 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -620,7 +620,8 @@ int f2fs_init_write_merge_io(struct f2fs_sb_info *sbi)
for (j = HOT; j < n; j++) {
struct f2fs_bio_info *io = &sbi->write_io[i][j];
- init_f2fs_rwsem(&io->io_rwsem);
+ init_f2fs_rwsem_trace(&io->io_rwsem, sbi,
+ LOCK_NAME_IO_RWSEM);
io->sbi = sbi;
io->bio = NULL;
io->last_block_in_bio = 0;
@@ -644,8 +645,9 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi,
{
enum page_type btype = PAGE_TYPE_OF_BIO(type);
struct f2fs_bio_info *io = sbi->write_io[btype] + temp;
+ struct f2fs_lock_context lc;
- f2fs_down_write(&io->io_rwsem);
+ f2fs_down_write_trace(&io->io_rwsem, &lc);
if (!io->bio)
goto unlock_out;
@@ -659,7 +661,7 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi,
}
__submit_merged_bio(io);
unlock_out:
- f2fs_up_write(&io->io_rwsem);
+ f2fs_up_write_trace(&io->io_rwsem, &lc);
}
static void __submit_merged_write_cond(struct f2fs_sb_info *sbi,
@@ -674,10 +676,11 @@ static void __submit_merged_write_cond(struct f2fs_sb_info *sbi,
if (!force) {
enum page_type btype = PAGE_TYPE_OF_BIO(type);
struct f2fs_bio_info *io = sbi->write_io[btype] + temp;
+ struct f2fs_lock_context lc;
- f2fs_down_read(&io->io_rwsem);
+ f2fs_down_read_trace(&io->io_rwsem, &lc);
ret = __has_merged_page(io->bio, inode, folio, ino);
- f2fs_up_read(&io->io_rwsem);
+ f2fs_up_read_trace(&io->io_rwsem, &lc);
}
if (ret) {
__f2fs_submit_merged_write(sbi, type, temp);
@@ -987,11 +990,12 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
enum page_type btype = PAGE_TYPE_OF_BIO(fio->type);
struct f2fs_bio_info *io = sbi->write_io[btype] + fio->temp;
struct folio *bio_folio;
+ struct f2fs_lock_context lc;
enum count_type type;
f2fs_bug_on(sbi, is_read_io(fio->op));
- f2fs_down_write(&io->io_rwsem);
+ f2fs_down_write_trace(&io->io_rwsem, &lc);
next:
#ifdef CONFIG_BLK_DEV_ZONED
if (f2fs_sb_has_blkzoned(sbi) && btype < META && io->zone_pending_bio) {
@@ -1073,7 +1077,7 @@ out:
if (is_sbi_flag_set(sbi, SBI_IS_SHUTDOWN) ||
!f2fs_is_checkpoint_ready(sbi))
__submit_merged_bio(io);
- f2fs_up_write(&io->io_rwsem);
+ f2fs_up_write_trace(&io->io_rwsem, &lc);
}
static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr,
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index dc08f6c06810..dc9f834bbe0d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -180,6 +180,7 @@ enum f2fs_lock_name {
LOCK_NAME_NODE_WRITE,
LOCK_NAME_GC_LOCK,
LOCK_NAME_CP_GLOBAL,
+ LOCK_NAME_IO_RWSEM,
};
/*
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index 859de7c8d1c7..c3b6b509472f 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -190,7 +190,8 @@ TRACE_DEFINE_ENUM(CP_PHASE_FINISH_CHECKPOINT);
{ LOCK_NAME_NODE_CHANGE, "node_change" }, \
{ LOCK_NAME_NODE_WRITE, "node_write" }, \
{ LOCK_NAME_GC_LOCK, "gc_lock" }, \
- { LOCK_NAME_CP_GLOBAL, "cp_global" })
+ { LOCK_NAME_CP_GLOBAL, "cp_global" }, \
+ { LOCK_NAME_IO_RWSEM, "io_rwsem" })
struct f2fs_sb_info;
struct f2fs_io_info;