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 node_write lock

Use f2fs_{down,up}_read_trace for node_write 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
bb28b668 f9f93602

+16 -11
+3 -3
fs/f2fs/compress.c
··· 1309 1309 * checkpoint. This can only happen to quota writes which can cause 1310 1310 * the below discard race condition. 1311 1311 */ 1312 - f2fs_down_read(&sbi->node_write); 1312 + f2fs_down_read_trace(&sbi->node_write, &lc); 1313 1313 } else if (!f2fs_trylock_op(sbi, &lc)) { 1314 1314 goto out_free; 1315 1315 } ··· 1434 1434 1435 1435 f2fs_put_dnode(&dn); 1436 1436 if (quota_inode) 1437 - f2fs_up_read(&sbi->node_write); 1437 + f2fs_up_read_trace(&sbi->node_write, &lc); 1438 1438 else 1439 1439 f2fs_unlock_op(sbi, &lc); 1440 1440 ··· 1463 1463 f2fs_put_dnode(&dn); 1464 1464 out_unlock_op: 1465 1465 if (quota_inode) 1466 - f2fs_up_read(&sbi->node_write); 1466 + f2fs_up_read_trace(&sbi->node_write, &lc); 1467 1467 else 1468 1468 f2fs_unlock_op(sbi, &lc); 1469 1469 out_free:
+4 -2
fs/f2fs/data.c
··· 3064 3064 write: 3065 3065 /* Dentry/quota blocks are controlled by checkpoint */ 3066 3066 if (S_ISDIR(inode->i_mode) || quota_inode) { 3067 + struct f2fs_lock_context lc; 3068 + 3067 3069 /* 3068 3070 * We need to wait for node_write to avoid block allocation during 3069 3071 * checkpoint. This can only happen to quota writes which can cause 3070 3072 * the below discard race condition. 3071 3073 */ 3072 3074 if (quota_inode) 3073 - f2fs_down_read(&sbi->node_write); 3075 + f2fs_down_read_trace(&sbi->node_write, &lc); 3074 3076 3075 3077 fio.need_lock = LOCK_DONE; 3076 3078 err = f2fs_do_write_data_page(&fio); 3077 3079 3078 3080 if (quota_inode) 3079 - f2fs_up_read(&sbi->node_write); 3081 + f2fs_up_read_trace(&sbi->node_write, &lc); 3080 3082 3081 3083 goto done; 3082 3084 }
+1
fs/f2fs/f2fs.h
··· 177 177 LOCK_NAME_NONE, 178 178 LOCK_NAME_CP_RWSEM, 179 179 LOCK_NAME_NODE_CHANGE, 180 + LOCK_NAME_NODE_WRITE, 180 181 }; 181 182 182 183 /*
+5 -4
fs/f2fs/node.c
··· 1738 1738 .io_type = io_type, 1739 1739 .io_wbc = wbc, 1740 1740 }; 1741 + struct f2fs_lock_context lc; 1741 1742 unsigned int seq; 1742 1743 1743 1744 trace_f2fs_writepage(folio, NODE); ··· 1768 1767 if (f2fs_get_node_info(sbi, nid, &ni, !do_balance)) 1769 1768 goto redirty_out; 1770 1769 1771 - f2fs_down_read(&sbi->node_write); 1770 + f2fs_down_read_trace(&sbi->node_write, &lc); 1772 1771 1773 1772 /* This page is already truncated */ 1774 1773 if (unlikely(ni.blk_addr == NULL_ADDR)) { 1775 1774 folio_clear_uptodate(folio); 1776 1775 dec_page_count(sbi, F2FS_DIRTY_NODES); 1777 - f2fs_up_read(&sbi->node_write); 1776 + f2fs_up_read_trace(&sbi->node_write, &lc); 1778 1777 folio_unlock(folio); 1779 1778 return true; 1780 1779 } ··· 1782 1781 if (__is_valid_data_blkaddr(ni.blk_addr) && 1783 1782 !f2fs_is_valid_blkaddr(sbi, ni.blk_addr, 1784 1783 DATA_GENERIC_ENHANCE)) { 1785 - f2fs_up_read(&sbi->node_write); 1784 + f2fs_up_read_trace(&sbi->node_write, &lc); 1786 1785 goto redirty_out; 1787 1786 } 1788 1787 ··· 1802 1801 f2fs_do_write_node_page(nid, &fio); 1803 1802 set_node_addr(sbi, &ni, fio.new_blkaddr, is_fsync_dnode(folio)); 1804 1803 dec_page_count(sbi, F2FS_DIRTY_NODES); 1805 - f2fs_up_read(&sbi->node_write); 1804 + f2fs_up_read_trace(&sbi->node_write, &lc); 1806 1805 1807 1806 folio_unlock(folio); 1808 1807
+1 -1
fs/f2fs/super.c
··· 4896 4896 init_f2fs_rwsem(&sbi->gc_lock); 4897 4897 mutex_init(&sbi->writepages); 4898 4898 init_f2fs_rwsem(&sbi->cp_global_sem); 4899 - init_f2fs_rwsem(&sbi->node_write); 4899 + init_f2fs_rwsem_trace(&sbi->node_write, sbi, LOCK_NAME_NODE_WRITE); 4900 4900 init_f2fs_rwsem_trace(&sbi->node_change, sbi, LOCK_NAME_NODE_CHANGE); 4901 4901 spin_lock_init(&sbi->stat_lock); 4902 4902 init_f2fs_rwsem_trace(&sbi->cp_rwsem, sbi, LOCK_NAME_CP_RWSEM);
+2 -1
include/trace/events/f2fs.h
··· 187 187 #define show_lock_name(lock) \ 188 188 __print_symbolic(lock, \ 189 189 { LOCK_NAME_CP_RWSEM, "cp_rwsem" }, \ 190 - { LOCK_NAME_NODE_CHANGE, "node_change" }) 190 + { LOCK_NAME_NODE_CHANGE, "node_change" }, \ 191 + { LOCK_NAME_NODE_WRITE, "node_write" }) 191 192 192 193 struct f2fs_sb_info; 193 194 struct f2fs_io_info;