Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Chao Yu and committed by
Jaegeuk Kim
67972c2b ce9fe67c

+14 -8
+11 -7
fs/f2fs/data.c
··· 620 620 for (j = HOT; j < n; j++) { 621 621 struct f2fs_bio_info *io = &sbi->write_io[i][j]; 622 622 623 - init_f2fs_rwsem(&io->io_rwsem); 623 + init_f2fs_rwsem_trace(&io->io_rwsem, sbi, 624 + LOCK_NAME_IO_RWSEM); 624 625 io->sbi = sbi; 625 626 io->bio = NULL; 626 627 io->last_block_in_bio = 0; ··· 645 644 { 646 645 enum page_type btype = PAGE_TYPE_OF_BIO(type); 647 646 struct f2fs_bio_info *io = sbi->write_io[btype] + temp; 647 + struct f2fs_lock_context lc; 648 648 649 - f2fs_down_write(&io->io_rwsem); 649 + f2fs_down_write_trace(&io->io_rwsem, &lc); 650 650 651 651 if (!io->bio) 652 652 goto unlock_out; ··· 661 659 } 662 660 __submit_merged_bio(io); 663 661 unlock_out: 664 - f2fs_up_write(&io->io_rwsem); 662 + f2fs_up_write_trace(&io->io_rwsem, &lc); 665 663 } 666 664 667 665 static void __submit_merged_write_cond(struct f2fs_sb_info *sbi, ··· 676 674 if (!force) { 677 675 enum page_type btype = PAGE_TYPE_OF_BIO(type); 678 676 struct f2fs_bio_info *io = sbi->write_io[btype] + temp; 677 + struct f2fs_lock_context lc; 679 678 680 - f2fs_down_read(&io->io_rwsem); 679 + f2fs_down_read_trace(&io->io_rwsem, &lc); 681 680 ret = __has_merged_page(io->bio, inode, folio, ino); 682 - f2fs_up_read(&io->io_rwsem); 681 + f2fs_up_read_trace(&io->io_rwsem, &lc); 683 682 } 684 683 if (ret) { 685 684 __f2fs_submit_merged_write(sbi, type, temp); ··· 990 987 enum page_type btype = PAGE_TYPE_OF_BIO(fio->type); 991 988 struct f2fs_bio_info *io = sbi->write_io[btype] + fio->temp; 992 989 struct folio *bio_folio; 990 + struct f2fs_lock_context lc; 993 991 enum count_type type; 994 992 995 993 f2fs_bug_on(sbi, is_read_io(fio->op)); 996 994 997 - f2fs_down_write(&io->io_rwsem); 995 + f2fs_down_write_trace(&io->io_rwsem, &lc); 998 996 next: 999 997 #ifdef CONFIG_BLK_DEV_ZONED 1000 998 if (f2fs_sb_has_blkzoned(sbi) && btype < META && io->zone_pending_bio) { ··· 1077 1073 if (is_sbi_flag_set(sbi, SBI_IS_SHUTDOWN) || 1078 1074 !f2fs_is_checkpoint_ready(sbi)) 1079 1075 __submit_merged_bio(io); 1080 - f2fs_up_write(&io->io_rwsem); 1076 + f2fs_up_write_trace(&io->io_rwsem, &lc); 1081 1077 } 1082 1078 1083 1079 static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr,
+1
fs/f2fs/f2fs.h
··· 180 180 LOCK_NAME_NODE_WRITE, 181 181 LOCK_NAME_GC_LOCK, 182 182 LOCK_NAME_CP_GLOBAL, 183 + LOCK_NAME_IO_RWSEM, 183 184 }; 184 185 185 186 /*
+2 -1
include/trace/events/f2fs.h
··· 190 190 { LOCK_NAME_NODE_CHANGE, "node_change" }, \ 191 191 { LOCK_NAME_NODE_WRITE, "node_write" }, \ 192 192 { 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" }) 194 195 195 196 struct f2fs_sb_info; 196 197 struct f2fs_io_info;