diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2021-12-14 00:28:40 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2022-01-05 00:20:19 +0300 |
commit | 0df035c7208c5e3e2ae7685548353ae536a19015 (patch) | |
tree | 6b91d03491047ae54df65ac58ef6fa9b572c5d0d /fs/f2fs | |
parent | 7377e853967ba45bf409e3b5536624d2cbc99f21 (diff) | |
download | linux-0df035c7208c5e3e2ae7685548353ae536a19015.tar.xz |
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 <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/node.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 556fcd8457f3..b1bc7d76da3b 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; |