From: Jaegeuk Kim Date: Mon, 13 Dec 2021 21:28:40 +0000 (-0800) Subject: f2fs: avoid down_write on nat_tree_lock during checkpoint X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=0df035c7208c5e3e2ae7685548353ae536a19015;p=linux.git f2fs: avoid down_write on nat_tree_lock during checkpoint Let's cache nat entry if there's no lock contention only. Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 556fcd8457f3f..b1bc7d76da3b6 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -430,6 +430,10 @@ static void cache_nat_entry(struct f2fs_sb_info *sbi, nid_t nid, struct f2fs_nm_info *nm_i = NM_I(sbi); struct nat_entry *new, *e; + /* Let's mitigate lock contention of nat_tree_lock during checkpoint */ + if (rwsem_is_locked(&sbi->cp_global_sem)) + return; + new = __alloc_nat_entry(sbi, nid, false); if (!new) return;