f2fs: avoid down_write on nat_tree_lock during checkpoint

[ Upstream commit 0df035c720 ]

Let's cache nat entry if there's no lock contention only.

Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Stable-dep-of: 3aa51c61cb ("f2fs: retry to update the inode page given data corruption")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Jaegeuk Kim 2021-12-13 13:28:40 -08:00 коммит произвёл Greg Kroah-Hartman
Родитель 31b5793ca2
Коммит e553323198
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -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;