Skip to content

Commit 67972c2

Browse files
chaseyuJaegeuk Kim
authored andcommitted
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>
1 parent ce9fe67 commit 67972c2

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

fs/f2fs/data.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,8 @@ int f2fs_init_write_merge_io(struct f2fs_sb_info *sbi)
620620
for (j = HOT; j < n; j++) {
621621
struct f2fs_bio_info *io = &sbi->write_io[i][j];
622622

623-
init_f2fs_rwsem(&io->io_rwsem);
623+
init_f2fs_rwsem_trace(&io->io_rwsem, sbi,
624+
LOCK_NAME_IO_RWSEM);
624625
io->sbi = sbi;
625626
io->bio = NULL;
626627
io->last_block_in_bio = 0;
@@ -644,8 +645,9 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi,
644645
{
645646
enum page_type btype = PAGE_TYPE_OF_BIO(type);
646647
struct f2fs_bio_info *io = sbi->write_io[btype] + temp;
648+
struct f2fs_lock_context lc;
647649

648-
f2fs_down_write(&io->io_rwsem);
650+
f2fs_down_write_trace(&io->io_rwsem, &lc);
649651

650652
if (!io->bio)
651653
goto unlock_out;
@@ -659,7 +661,7 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi,
659661
}
660662
__submit_merged_bio(io);
661663
unlock_out:
662-
f2fs_up_write(&io->io_rwsem);
664+
f2fs_up_write_trace(&io->io_rwsem, &lc);
663665
}
664666

665667
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,
674676
if (!force) {
675677
enum page_type btype = PAGE_TYPE_OF_BIO(type);
676678
struct f2fs_bio_info *io = sbi->write_io[btype] + temp;
679+
struct f2fs_lock_context lc;
677680

678-
f2fs_down_read(&io->io_rwsem);
681+
f2fs_down_read_trace(&io->io_rwsem, &lc);
679682
ret = __has_merged_page(io->bio, inode, folio, ino);
680-
f2fs_up_read(&io->io_rwsem);
683+
f2fs_up_read_trace(&io->io_rwsem, &lc);
681684
}
682685
if (ret) {
683686
__f2fs_submit_merged_write(sbi, type, temp);
@@ -987,11 +990,12 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
987990
enum page_type btype = PAGE_TYPE_OF_BIO(fio->type);
988991
struct f2fs_bio_info *io = sbi->write_io[btype] + fio->temp;
989992
struct folio *bio_folio;
993+
struct f2fs_lock_context lc;
990994
enum count_type type;
991995

992996
f2fs_bug_on(sbi, is_read_io(fio->op));
993997

994-
f2fs_down_write(&io->io_rwsem);
998+
f2fs_down_write_trace(&io->io_rwsem, &lc);
995999
next:
9961000
#ifdef CONFIG_BLK_DEV_ZONED
9971001
if (f2fs_sb_has_blkzoned(sbi) && btype < META && io->zone_pending_bio) {
@@ -1073,7 +1077,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
10731077
if (is_sbi_flag_set(sbi, SBI_IS_SHUTDOWN) ||
10741078
!f2fs_is_checkpoint_ready(sbi))
10751079
__submit_merged_bio(io);
1076-
f2fs_up_write(&io->io_rwsem);
1080+
f2fs_up_write_trace(&io->io_rwsem, &lc);
10771081
}
10781082

10791083
static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr,

fs/f2fs/f2fs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ enum f2fs_lock_name {
180180
LOCK_NAME_NODE_WRITE,
181181
LOCK_NAME_GC_LOCK,
182182
LOCK_NAME_CP_GLOBAL,
183+
LOCK_NAME_IO_RWSEM,
183184
};
184185

185186
/*

include/trace/events/f2fs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ TRACE_DEFINE_ENUM(CP_PHASE_FINISH_CHECKPOINT);
190190
{ LOCK_NAME_NODE_CHANGE, "node_change" }, \
191191
{ LOCK_NAME_NODE_WRITE, "node_write" }, \
192192
{ LOCK_NAME_GC_LOCK, "gc_lock" }, \
193-
{ LOCK_NAME_CP_GLOBAL, "cp_global" })
193+
{ LOCK_NAME_CP_GLOBAL, "cp_global" }, \
194+
{ LOCK_NAME_IO_RWSEM, "io_rwsem" })
194195

195196
struct f2fs_sb_info;
196197
struct f2fs_io_info;

0 commit comments

Comments
 (0)